From 9ae21bac11248be3047d8a0878172316decdd2dc Mon Sep 17 00:00:00 2001 From: unix Date: Sat, 20 Jun 2020 13:05:43 +0800 Subject: [PATCH] test(grid): add testcase for grid hidden --- .../__snapshots__/index.test.tsx.snap | 120 ++++++++++++++++++ components/grid/__tests__/index.test.tsx | 6 + 2 files changed, 126 insertions(+) diff --git a/components/grid/__tests__/__snapshots__/index.test.tsx.snap b/components/grid/__tests__/__snapshots__/index.test.tsx.snap index 1f8e917..c0253ff 100644 --- a/components/grid/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/grid/__tests__/__snapshots__/index.test.tsx.snap @@ -25,6 +25,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 4.166666666666667%; flex-basis: 4.166666666666667%; + display: flex; } @media only screen and (max-width: 650px) { @@ -32,6 +33,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 4.166666666666667%; flex-basis: 4.166666666666667%; + display: flex; } } @@ -40,6 +42,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 8.333333333333334%; flex-basis: 8.333333333333334%; + display: flex; } } @@ -48,6 +51,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 12.5%; flex-basis: 12.5%; + display: flex; } } @@ -56,6 +60,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 16.666666666666668%; flex-basis: 16.666666666666668%; + display: flex; } } @@ -64,6 +69,7 @@ exports[`Grid all breakpoint values should be supported 1`] = ` flex-grow: 0; max-width: 20.833333333333336%; flex-basis: 20.833333333333336%; + display: flex; } } " @@ -159,6 +171,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } @media only screen and (max-width: 650px) { @@ -166,6 +179,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -174,6 +188,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -182,6 +197,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -190,6 +206,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -198,6 +215,7 @@ exports[`Grid css value should be passed through 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } " @@ -293,6 +317,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } @media only screen and (max-width: 650px) { @@ -300,6 +325,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -308,6 +334,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -316,6 +343,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -324,6 +352,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -332,6 +361,7 @@ exports[`Grid decimal spacing should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } " @@ -427,6 +463,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } @media only screen and (max-width: 650px) { @@ -434,6 +471,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -442,6 +480,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -450,6 +489,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -458,6 +498,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -466,6 +507,7 @@ exports[`Grid nested components should be supported 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } }
test
test
test
,
,
," @@ -951,6 +1035,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } @media only screen and (max-width: 650px) { @@ -958,6 +1043,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -966,6 +1052,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -974,6 +1061,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -982,6 +1070,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -990,6 +1079,7 @@ exports[`Grid should render correctly 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } }
test
" @@ -1150,6 +1252,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 0; max-width: 100%; flex-basis: 100%; + display: flex; } @media only screen and (max-width: 650px) { @@ -1157,6 +1260,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 0; max-width: 100%; flex-basis: 100%; + display: flex; } } @@ -1165,6 +1269,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -1173,6 +1278,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -1181,6 +1287,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } } @@ -1189,6 +1296,7 @@ exports[`Grid should work correctly when size exceeds 1`] = ` flex-grow: 1; max-width: 100%; flex-basis: 0; + display: flex; } }
test
" diff --git a/components/grid/__tests__/index.test.tsx b/components/grid/__tests__/index.test.tsx index 72250d0..f40b00a 100644 --- a/components/grid/__tests__/index.test.tsx +++ b/components/grid/__tests__/index.test.tsx @@ -111,4 +111,10 @@ describe('Grid', () => { expect(wrapper.html()).toMatchSnapshot() expect(() => wrapper.unmount()).not.toThrow() }) + + it('Grid should be hidden when value is 0', () => { + let wrapper = mount() + expect(wrapper.find('.item').hasClass('xs')).toBeTruthy() + expect(wrapper.find('.item').html()).toContain('display: none') + }) })