Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cvle committed Nov 20, 2016
1 parent 4948b19 commit 1bc4667
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 53 deletions.
54 changes: 13 additions & 41 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
35 changes: 24 additions & 11 deletions src/index.test.js → test/integration.test.js
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand Down
15 changes: 15 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -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}`)
}
2 changes: 1 addition & 1 deletion tests.webpack.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
const context = require.context('./src', true, /\.test\.js$/)
const context = require.context('./test', true, /\.test\.js$/)
context.keys().forEach(context)

0 comments on commit 1bc4667

Please sign in to comment.