diff --git a/browsers.json b/browsers.json index bb5e2894..e902a541 100644 --- a/browsers.json +++ b/browsers.json @@ -1,59 +1,31 @@ { - "BS_Safari": { + "BS_Opera22": { "base": "BrowserStack", "os": "OS X", "os_version": "Yosemite", - "browser": "safari", - "browser_version": "8.0" + "browser": "opera", + "browser_version": "22.0" }, - "BS_Safari": { + "BS_Chrome28": { "base": "BrowserStack", "os": "OS X", "os_version": "Mavericks", - "browser": "safari", - "browser_version": "7.0" + "browser": "chrome", + "browser_version": "28.0" }, - "BS_Chrome": { + "BS_Safari8": { "base": "BrowserStack", "os": "OS X", "os_version": "Yosemite", - "browser": "chrome", - "browser_version": "49.0" + "browser": "safari", + "browser_version": "8.0" }, - "BS_Firefox": { + "BS_Firefox25": { "base": "BrowserStack", "os": "OS X", "os_version": "Yosemite", "browser": "firefox", - "browser_version": "45.0" - }, - "BS_MobileSafari": { - "base": "BrowserStack", - "os": "ios", - "os_version": "8.0", - "browser": "iphone", - "real_mobile": false - }, - "BS_MobileSafari": { - "base": "BrowserStack", - "os": "ios", - "os_version": "9.0", - "browser": "iphone", - "real_mobile": false - }, - "BS_Chrome": { - "base": "BrowserStack", - "os": "Windows", - "os_version": "8.1", - "browser": "chrome", - "browser_version": "49.0" - }, - "BS_Firefox": { - "base": "BrowserStack", - "os": "Windows", - "os_version": "8.1", - "browser": "firefox", - "browser_version": "45.0" + "browser_version": "25.0" }, "BS_InternetExplorer9": { "base": "BrowserStack", @@ -76,11 +48,11 @@ "browser": "ie", "browser_version": "11.0" }, - "BS_Edge": { + "BS_Edge13": { "base": "BrowserStack", "os": "Windows", "os_version": "10", "browser": "edge", - "browser_version": "14" + "browser_version": "13.0" } } diff --git a/package.json b/package.json index 624da86e..cf5e92c9 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "babel-plugin-transform-es3-property-literals": "^6.8.0", "babel-preset-es2015": "^6.9.0", "babel-preset-stage-0": "^6.5.0", + "bowser": "^1.5.0", "cross-env": "^3.1.3", "es5-shim": "^4.5.9", "eslint": "^2.8.0", diff --git a/src/index.test.js b/test/integration.test.js similarity index 62% rename from src/index.test.js rename to test/integration.test.js index 16a73416..426d54d5 100644 --- a/src/index.test.js +++ b/test/integration.test.js @@ -1,6 +1,7 @@ import expect from 'expect.js' -import {prefix, supportedProperty, supportedValue} from './index' +import {prefix, supportedProperty, supportedValue} from '../src/index' +import {browser} from './utils' describe('css-vendor', () => { describe('.prefix', () => { @@ -22,11 +23,20 @@ describe('css-vendor', () => { expect(supportedProperty('display')).to.be('display') }) - it('should prefix if needed', () => { - const prop = supportedProperty(`${prefix.css}animation`) - if (prop !== 'animation') { - expect(prop).to.be(`${prefix.css}animation`) - } + browser("requires prefix for transform property", { + msie: "9", + firefox: "3.5-15", + chrome: "4-35", + safari: "3.1-8", + opera: "11.5-22", + ios: "3.2-8.4", + android: "2.1-4.4.4", + blackberry: "7-10", + ucbrowser: "11", + }, () => { + it('should prefix', () => { + expect(supportedProperty('transform')).to.be(`${prefix.css}transform`) + }) }) it('should return false', () => { @@ -44,11 +54,14 @@ describe('css-vendor', () => { expect(supportedValue('color', value)).to.be(value) }) - it('should should prefix if needed', () => { - const value = supportedValue('display', 'flex') - if (value !== 'flex') { - expect(value).to.be(`${prefix.css}flex`) - } + browser("requires prefix for flex value", { + chrome: "21-28", + safari: "7-8", + ios: "7.1-8.4", + }, () => { + it('should prefix', () => { + expect(supportedValue('display', 'flex')).to.be(`${prefix.css}flex`) + }) }) it('should return false for unknown value', () => { diff --git a/test/utils.js b/test/utils.js new file mode 100644 index 00000000..c7f7e1ce --- /dev/null +++ b/test/utils.js @@ -0,0 +1,15 @@ +import * as bowser from 'bowser' + +const version = parseFloat(bowser.version) + +export function browser(desc, browsers, cb) { + for (const b in browsers) { + if (bowser[b]) { + let [from, to] = browsers[b].split("-").map((x) => parseFloat(x)) + if (to === undefined) to = from + if (version >= from && version <= to) return describe(desc, cb) + break + } + } + console.log(`skip "${desc}" for ${bowser.name} ${bowser.version}`) +} diff --git a/tests.webpack.js b/tests.webpack.js index cfb66253..bf52a84a 100644 --- a/tests.webpack.js +++ b/tests.webpack.js @@ -1,2 +1,2 @@ -const context = require.context('./src', true, /\.test\.js$/) +const context = require.context('./test', true, /\.test\.js$/) context.keys().forEach(context)