Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rofrischmann committed Feb 17, 2017
1 parent d407efa commit 78d2705
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ dynamic/**/*
generator/**/*
utils/**/*
coverage/**/*
modules/dynamic/propertyPrefixMap.js
modules/static/propertyPrefixMap.js
modules/dynamic/dynamicData.js
modules/static/staticData.js
2 changes: 2 additions & 0 deletions .istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
instrumentation:
excludes: ['modules/generator/**']
6 changes: 3 additions & 3 deletions modules/dynamic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import position from './plugins/position'
import sizing from './plugins/sizing'
import transition from './plugins/transition'

import prefixAll from '../static'
import { prefixMap } from './dynamicData'

const plugins = [
crossFade,
cursor,
Expand All @@ -24,9 +27,6 @@ const plugins = [
flex
]

import prefixAll from '../static'
import { prefixMap } from './dynamicData'

const Prefixer = createPrefixer(
{
prefixMap,
Expand Down
8 changes: 0 additions & 8 deletions modules/generator/generateDynamicPrefixMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ const flexPropsIE = [
'flexBasis'
]

function filterAndRemoveIfEmpty(map: Object, property: string, filter: Function): void {
map[property] = map[property].filter(filter)

if (map[property].length === 0) {
delete map[property]
}
}

export default function generateDynamicPrefixMap(browserList: Object): Object {
const prefixMap = {}

Expand Down
2 changes: 0 additions & 2 deletions modules/generator/generateStaticPrefixMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const prefixBrowserMap = {
ie_mob: 'ms'
}

const browsers = Object.keys(prefixBrowserMap)

// remove flexprops from IE
const flexPropsIE = [
'alignContent',
Expand Down
44 changes: 15 additions & 29 deletions test/dynamic/createPrefixer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,15 @@ describe('Dynamic Prefixer', () => {
})
})
describe('Running on android < 4.4', () => {
it(
'should use the osversion if its the native browser to check for required props',
() => {
const andPrefixer = new Prefixer({ userAgent: Android4_4_4 })
console.log(andPrefixer._browserInfo)
expect(
andPrefixer._browserInfo.browserVersion
).to.eql(andPrefixer._browserInfo.osVersion)
expect(andPrefixer._browserInfo.browserVersion).to.eql(4.4)
const transform = { transform: 'rotate(40deg)' }
const output = { WebkitTransform: 'rotate(40deg)' }
expect(new Prefixer({ userAgent: Android4_4_4 }).prefix(transform)).to.eql(output)
}
)
it('should use the osversion if its the native browser to check for required props', () => {
const andPrefixer = new Prefixer({ userAgent: Android4_4_4 })
console.log(andPrefixer._browserInfo)
expect(andPrefixer._browserInfo.browserVersion).to.eql(andPrefixer._browserInfo.osVersion)
expect(andPrefixer._browserInfo.browserVersion).to.eql(4.4)
const transform = { transform: 'rotate(40deg)' }
const output = { WebkitTransform: 'rotate(40deg)' }
expect(new Prefixer({ userAgent: Android4_4_4 }).prefix(transform)).to.eql(output)
})
it('should use the chrome version if its chrome to check for required props', () => {
const andPrefixer = new Prefixer({ userAgent: Android4_2_2Chrome47 })
expect(andPrefixer._browserInfo.osVersion).to.eql(4.2)
Expand All @@ -84,9 +79,7 @@ describe('Dynamic Prefixer', () => {
it('always force Safari prefixing as iOS forces to use Safari under the hood', () => {
const iosPrefixer = new Prefixer({ userAgent: iOSChrome47 })
console.log(iosPrefixer._browserInfo)
expect(
iosPrefixer._browserInfo.browserVersion
).to.eql(iosPrefixer._browserInfo.osVersion)
expect(iosPrefixer._browserInfo.browserVersion).to.eql(iosPrefixer._browserInfo.osVersion)
const input = { display: 'flex' }
const output = { display: '-webkit-flex' }
expect(iosPrefixer.prefix(input)).to.eql(output)
Expand Down Expand Up @@ -223,9 +216,7 @@ describe('Dynamic Prefixer', () => {
})
describe('Prefixing keyframes', () => {
it('should return the correct keyframes string', () => {
expect(
new Prefixer({ userAgent: Chrome14 }).prefixedKeyframes
).to.eql('-webkit-keyframes')
expect(new Prefixer({ userAgent: Chrome14 }).prefixedKeyframes).to.eql('-webkit-keyframes')
expect(new Prefixer({ userAgent: Chrome49 }).prefixedKeyframes).to.eql('keyframes')
expect(new Prefixer({ userAgent: Chromium }).prefixedKeyframes).to.eql('keyframes')
expect(new Prefixer({ userAgent: PhantomJS }).prefixedKeyframes).to.eql('keyframes')
Expand All @@ -238,6 +229,7 @@ describe('Dynamic Prefixer', () => {
expect(new Prefixer({ userAgent: Chrome22 }).prefix(input)).to.eql(prefixed)
})
})

describe('Prefixing transitions', () => {
it('should add prefixes to properties in value', () => {
const input = { transition: 'appearance 200ms linear' }
Expand Down Expand Up @@ -379,17 +371,11 @@ describe('Dynamic Prefixer', () => {
})
describe('Prefixing display', () => {
it('should not remove display property', () => {
expect(
new Prefixer({ userAgent: MSIE10 }).prefix({ display: 'block' })
).to.eql({ display: 'block' })
expect(new Prefixer({ userAgent: MSIE10 }).prefix({ display: 'block' })).to.eql({ display: 'block' })
})
it('should not throw if display is null or undefined', () => {
expect(
new Prefixer({ userAgent: Chrome45 }).prefix({ display: null })
).to.eql({ display: null })
expect(
new Prefixer({ userAgent: Chrome45 }).prefix({ display: undefined })
).to.eql({ display: undefined })
expect(new Prefixer({ userAgent: Chrome45 }).prefix({ display: null })).to.eql({ display: null })
expect(new Prefixer({ userAgent: Chrome45 }).prefix({ display: undefined })).to.eql({ display: undefined })
})
})
describe('Using Prefixer.prefixAll', () => {
Expand Down

0 comments on commit 78d2705

Please sign in to comment.