From eb7706260813f843a9d7d7ad90e2d612d11f867f Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 21 Jan 2019 12:32:31 -0800 Subject: [PATCH] Remove unnecessary snapshot tests Remove snapshots that were unnecessarily recording generated CSS output. --- .../__snapshots__/index-test.js.snap | 49 ------------------- .../AppRegistry/__tests__/index-test.js | 3 -- .../__tests__/StyleSheetManager-test.js | 8 ++- .../StyleSheetManager-test.js.snap | 13 ----- 4 files changed, 6 insertions(+), 67 deletions(-) diff --git a/packages/react-native-web/src/exports/AppRegistry/__tests__/__snapshots__/index-test.js.snap b/packages/react-native-web/src/exports/AppRegistry/__tests__/__snapshots__/index-test.js.snap index b2f26204e..7e43cd41a 100644 --- a/packages/react-native-web/src/exports/AppRegistry/__tests__/__snapshots__/index-test.js.snap +++ b/packages/react-native-web/src/exports/AppRegistry/__tests__/__snapshots__/index-test.js.snap @@ -1,54 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AppRegistry getApplication "getStyleElement" produces styles that are a function of rendering "element": Additional CSS for styled app 1`] = ` -" -.rn-backgroundColor-aot4c7{background-color:rgba(128,0,128,1.00)} -.rn-borderTopWidth-10pzpfo{border-top-width:1234px} -.rn-borderRightWidth-1y24uml{border-right-width:1234px} -.rn-borderBottomWidth-98wxn4{border-bottom-width:1234px} -.rn-borderLeftWidth-150mub4{border-left-width:1234px}" -`; - -exports[`AppRegistry getApplication "getStyleElement" produces styles that are a function of rendering "element": CSS for an unstyled app 1`] = ` -"@media all{ -html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);} -body{margin:0;} -button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;} -input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;} -} -.rn-pointerEvents-12vffkv > *{pointer-events:auto} -.rn-pointerEvents-12vffkv{pointer-events:none !important} -.rn-alignItems-1oszu61{-ms-flex-align:stretch;-webkit-align-items:stretch;-webkit-box-align:stretch;align-items:stretch} -.rn-borderTopStyle-1efd50x{border-top-style:solid} -.rn-borderRightStyle-14skgim{border-right-style:solid} -.rn-borderBottomStyle-rull8r{border-bottom-style:solid} -.rn-borderLeftStyle-mm0ijv{border-left-style:solid} -.rn-borderTopWidth-13yce4e{border-top-width:0px} -.rn-borderRightWidth-fnigne{border-right-width:0px} -.rn-borderBottomWidth-ndvcnb{border-bottom-width:0px} -.rn-borderLeftWidth-gxnn5r{border-left-width:0px} -.rn-boxSizing-deolkf{box-sizing:border-box} -.rn-display-6koalj{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex} -.rn-flexShrink-1qe8dj5{-ms-flex-negative:0;-webkit-flex-shrink:0;flex-shrink:0} -.rn-flexBasis-1mlwlqe{-ms-flex-preferred-size:auto;-webkit-flex-basis:auto;flex-basis:auto} -.rn-flexDirection-eqz5dr{-ms-flex-direction:column;-webkit-box-direction:normal;-webkit-box-orient:vertical;-webkit-flex-direction:column;flex-direction:column} -.rn-marginTop-1mnahxq{margin-top:0px} -.rn-marginRight-61z16t{margin-right:0px} -.rn-marginBottom-p1pxzi{margin-bottom:0px} -.rn-marginLeft-11wrixw{margin-left:0px} -.rn-minHeight-ifefl9{min-height:0px} -.rn-minWidth-bcqeeo{min-width:0px} -.rn-paddingTop-wk8lta{padding-top:0px} -.rn-paddingRight-9aemit{padding-right:0px} -.rn-paddingBottom-1mdbw0j{padding-bottom:0px} -.rn-paddingLeft-gy4na3{padding-left:0px} -.rn-position-bnwqim{position:relative} -.rn-zIndex-1lgpqti{z-index:0} -.rn-flexGrow-16y2uox{-ms-flex-positive:1;-webkit-box-flex:1;-webkit-flex-grow:1;flex-grow:1} -.rn-flexShrink-1wbh5a2{-ms-flex-negative:1;-webkit-flex-shrink:1;flex-shrink:1} -.rn-flexBasis-1ro0kt6{-ms-flex-preferred-size:0%;-webkit-flex-basis:0%;flex-basis:0%}" -`; - exports[`AppRegistry getApplication returns "element" and "getStyleElement" 1`] = ` { // First render "RootComponent" AppRegistry.registerComponent('App', () => RootComponent); const first = getApplicationStyles('App'); - expect(first).toMatchSnapshot('CSS for an unstyled app'); // Second render "AlternativeComponent" AppRegistry.registerComponent('AlternativeApp', () => AlternativeComponent); const second = getApplicationStyles('AlternativeApp'); - const diff = second.split(first)[1]; expect(first).not.toEqual(second); - expect(diff).toMatchSnapshot('Additional CSS for styled app'); // Third render "RootComponent" again const third = getApplicationStyles('App'); diff --git a/packages/react-native-web/src/exports/StyleSheet/__tests__/StyleSheetManager-test.js b/packages/react-native-web/src/exports/StyleSheet/__tests__/StyleSheetManager-test.js index 091a6a36c..f6979495c 100644 --- a/packages/react-native-web/src/exports/StyleSheet/__tests__/StyleSheetManager-test.js +++ b/packages/react-native-web/src/exports/StyleSheet/__tests__/StyleSheetManager-test.js @@ -24,8 +24,12 @@ describe('StyleSheet/StyleSheetManager', () => { }); test('getStyleSheet', () => { - styleSheetManager.injectDeclaration('--test-property', 'test-value'); - expect(styleSheetManager.getStyleSheet()).toMatchSnapshot(); + expect(styleSheetManager.getStyleSheet()).toEqual( + expect.objectContaining({ + id: expect.any(String), + textContent: expect.any(String) + }) + ); }); test('injectDeclaration', () => { diff --git a/packages/react-native-web/src/exports/StyleSheet/__tests__/__snapshots__/StyleSheetManager-test.js.snap b/packages/react-native-web/src/exports/StyleSheet/__tests__/__snapshots__/StyleSheetManager-test.js.snap index 3142a0359..427fbd54f 100644 --- a/packages/react-native-web/src/exports/StyleSheet/__tests__/__snapshots__/StyleSheetManager-test.js.snap +++ b/packages/react-native-web/src/exports/StyleSheet/__tests__/__snapshots__/StyleSheetManager-test.js.snap @@ -1,16 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StyleSheet/StyleSheetManager getClassName 1`] = `undefined`; - -exports[`StyleSheet/StyleSheetManager getStyleSheet 1`] = ` -Object { - "id": "react-native-stylesheet", - "textContent": "@media all{ -html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);} -body{margin:0;} -button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;} -input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;} -} -.rn---test-property-ax3bxi{--test-property:test-value}", -} -`;