From 29f6bd363cbb1b768ac2b4a1940d622d173f9291 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 22 Feb 2016 19:23:05 -0800 Subject: [PATCH] Fix linting error and check-in test patch --- src/apis/InteractionManager/index.js | 2 +- src/apis/StyleSheet/__tests__/Store-test.js | 69 +++++++++++---------- src/components/Image/ImageResizeMode.js | 2 +- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/apis/InteractionManager/index.js b/src/apis/InteractionManager/index.js index 23ac6e78..45cc1338 100644 --- a/src/apis/InteractionManager/index.js +++ b/src/apis/InteractionManager/index.js @@ -11,7 +11,7 @@ import invariant from 'fbjs/lib/invariant' const InteractionManager = { Events: keyMirror({ interactionStart: true, - interactionComplete: true, + interactionComplete: true }), /** diff --git a/src/apis/StyleSheet/__tests__/Store-test.js b/src/apis/StyleSheet/__tests__/Store-test.js index b83cdf0c..d3419c48 100644 --- a/src/apis/StyleSheet/__tests__/Store-test.js +++ b/src/apis/StyleSheet/__tests__/Store-test.js @@ -6,9 +6,9 @@ import Store from '../Store' suite('apis/StyleSheet/Store', () => { suite('the constructor', () => { test('initialState', () => { - const initialState = { classNames: { 'alignItems:center': '__classname__' } } + const initialState = { classNames: { 'textAlign:center': '__classname__' } } const store = new Store(initialState) - assert.deepEqual(store._classNames['alignItems:center'], '__classname__') + assert.deepEqual(store._classNames['textAlign:center'], '__classname__') }) }) @@ -16,80 +16,81 @@ suite('apis/StyleSheet/Store', () => { test('returns a declaration-specific className', () => { const initialState = { classNames: { - 'alignItems:center': '__expected__', - 'alignItems:flex-start': '__error__' + 'textAlign:center': '__expected__', + 'textAlign:left': '__error__' } } const store = new Store(initialState) - assert.deepEqual(store.get('alignItems', 'center'), '__expected__') + assert.deepEqual(store.get('textAlign', 'center'), '__expected__') }) }) suite('#set', () => { test('stores declarations', () => { const store = new Store() - store.set('alignItems', 'center') - store.set('flexGrow', 0) - store.set('flexGrow', 1) - store.set('flexGrow', 2) + store.set('textAlign', 'center') + store.set('marginTop', 0) + store.set('marginTop', 1) + store.set('marginTop', 2) assert.deepEqual(store._declarations, { - alignItems: [ 'center' ], - flexGrow: [ 0, 1, 2 ] + textAlign: [ 'center' ], + marginTop: [ 0, 1, 2 ] }) }) test('human-readable classNames', () => { const store = new Store() - store.set('alignItems', 'center') - store.set('flexGrow', 0) - store.set('flexGrow', 1) - store.set('flexGrow', 2) + store.set('textAlign', 'center') + store.set('marginTop', 0) + store.set('marginTop', 1) + store.set('marginTop', 2) assert.deepEqual(store._classNames, { - 'alignItems:center': 'alignItems:center', - 'flexGrow:0': 'flexGrow:0', - 'flexGrow:1': 'flexGrow:1', - 'flexGrow:2': 'flexGrow:2' + 'textAlign:center': 'textAlign:center', + 'marginTop:0': 'marginTop:0', + 'marginTop:1': 'marginTop:1', + 'marginTop:2': 'marginTop:2' }) }) test('obfuscated classNames', () => { const store = new Store({}, { obfuscateClassNames: true }) - store.set('alignItems', 'center') - store.set('flexGrow', 0) - store.set('flexGrow', 1) - store.set('flexGrow', 2) + store.set('textAlign', 'center') + store.set('marginTop', 0) + store.set('marginTop', 1) + store.set('marginTop', 2) assert.deepEqual(store._classNames, { - 'alignItems:center': '_s_1', - 'flexGrow:0': '_s_2', - 'flexGrow:1': '_s_3', - 'flexGrow:2': '_s_4' + 'textAlign:center': '_s_1', + 'marginTop:0': '_s_2', + 'marginTop:1': '_s_3', + 'marginTop:2': '_s_4' }) }) test('replaces space characters', () => { const store = new Store() - store.set('margin', '0 auto') - assert.equal(store.get('margin', '0 auto'), 'margin\:0-auto') + store.set('backgroundPosition', 'top left') + assert.equal(store.get('backgroundPosition', 'top left'), 'backgroundPosition\:top-left') }) }) suite('#toString', () => { test('human-readable style sheet', () => { const store = new Store() - store.set('alignItems', 'center') + store.set('textAlign', 'center') store.set('backgroundColor', 'rgba(0,0,0,0)') store.set('color', '#fff') store.set('fontFamily', '"Helvetica Neue", Arial, sans-serif') store.set('marginBottom', '0px') store.set('width', '100%') + console.log(store.toString()) const expected = '/* 6 unique declarations */\n' + - '.alignItems\\:center{align-items:center;}\n' + '.backgroundColor\\:rgba\\(0\\,0\\,0\\,0\\){background-color:rgba(0,0,0,0);}\n' + '.color\\:\\#fff{color:#fff;}\n' + '.fontFamily\\:\\"Helvetica-Neue\\"\\,-Arial\\,-sans-serif{font-family:"Helvetica Neue", Arial, sans-serif;}\n' + '.marginBottom\\:0px{margin-bottom:0px;}\n' + + '.textAlign\\:center{text-align:center;}\n' + '.width\\:100\\%{width:100%;}' assert.equal(store.toString(), expected) @@ -97,18 +98,18 @@ suite('apis/StyleSheet/Store', () => { test('obfuscated style sheet', () => { const store = new Store({}, { obfuscateClassNames: true }) - store.set('alignItems', 'center') + store.set('textAlign', 'center') store.set('marginBottom', '0px') store.set('margin', '1px') store.set('margin', '2px') store.set('margin', '3px') const expected = '/* 5 unique declarations */\n' + - '._s_1{align-items:center;}\n' + '._s_3{margin:1px;}\n' + '._s_4{margin:2px;}\n' + '._s_5{margin:3px;}\n' + - '._s_2{margin-bottom:0px;}' + '._s_2{margin-bottom:0px;}\n' + + '._s_1{text-align:center;}' assert.equal(store.toString(), expected) }) diff --git a/src/components/Image/ImageResizeMode.js b/src/components/Image/ImageResizeMode.js index cd9b18ca..c78e2914 100644 --- a/src/components/Image/ImageResizeMode.js +++ b/src/components/Image/ImageResizeMode.js @@ -1,4 +1,4 @@ -import keyMirror from 'fbjs/lib/keyMirror'; +import keyMirror from 'fbjs/lib/keyMirror' const ImageResizeMode = keyMirror({ contain: null,