@@ -8,53 +8,53 @@ import { Card, CardList } from '../src/components'
88const namespaces = { foo : [ < Card title = "one" /> , < Card title = "two" /> ] , bar : [ < Card title = "three" /> ] }
99
1010describe ( 'Testing <Container />' , ( ) => {
11- beforeEach ( ( ) => {
12- history = createHistory ( )
13- } )
14-
15- it ( 'should show menu when no cards' , ( ) => {
16- const component = shallow ( < Container namespaces = { [ ] } history = { history } /> )
17- expect ( component . html ( ) ) . to . contain ( 'react-cards-menu' )
18- } )
19-
20- it ( 'should show menu when no active namespace' , ( ) => {
21- const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
22- expect ( component . html ( ) ) . to . contain ( 'react-cards-menu' )
23- } )
24-
25- it ( 'should hide menu when active namespace' , ( ) => {
26- history . push ( '/#/foo' )
27- const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
28- expect ( component . html ( ) ) . to . not . contain ( 'react-cards-menu' )
29- } )
30-
31- it ( 'should display no cards if active namespace doesn\'t contain cards' , ( ) => {
32- history . push ( '/#/foobar' )
33- const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
34- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
35- } )
36-
37- it ( 'should display all cards for active namespace' , ( ) => {
38- history . push ( '/#/foo' )
39- const component = mount ( < Container namespaces = { namespaces } history = { history } /> )
40- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
11+ beforeEach ( ( ) => {
12+ history = createHistory ( )
13+ } )
14+
15+ it ( 'should show menu when no cards' , ( ) => {
16+ const component = shallow ( < Container namespaces = { [ ] } history = { history } /> )
17+ expect ( component . html ( ) ) . to . contain ( 'react-cards-menu' )
18+ } )
19+
20+ it ( 'should show menu when no active namespace' , ( ) => {
21+ const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
22+ expect ( component . html ( ) ) . to . contain ( 'react-cards-menu' )
23+ } )
24+
25+ it ( 'should hide menu when active namespace' , ( ) => {
26+ history . push ( '/#/foo' )
27+ const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
28+ expect ( component . html ( ) ) . to . not . contain ( 'react-cards-menu' )
29+ } )
30+
31+ it ( 'should display no cards if active namespace doesn\'t contain cards' , ( ) => {
32+ history . push ( '/#/foobar' )
33+ const component = shallow ( < Container namespaces = { namespaces } history = { history } /> )
34+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
35+ } )
36+
37+ it ( 'should display all cards for active namespace' , ( ) => {
38+ history . push ( '/#/foo' )
39+ const component = mount ( < Container namespaces = { namespaces } history = { history } /> )
40+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
4141 // 1 nav header card + 2 foo cards
42- expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 3 )
43- } )
44-
45- it ( 'should display change card when active namespace changes' , ( ) => {
46- history . push ( '/' )
47- const component = mount ( < Container namespaces = { namespaces } history = { history } /> )
48- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
49- history . push ( '/#/foo' )
50- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
42+ expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 3 )
43+ } )
44+
45+ it ( 'should display change card when active namespace changes' , ( ) => {
46+ history . push ( '/' )
47+ const component = mount ( < Container namespaces = { namespaces } history = { history } /> )
48+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
49+ history . push ( '/#/foo' )
50+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
5151 // 1 nav header card + 2 foo cards
52- expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 3 )
53- history . push ( '/#/foobar' )
54- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
55- history . push ( '/#/bar' )
56- expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
52+ expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 3 )
53+ history . push ( '/#/foobar' )
54+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 0 )
55+ history . push ( '/#/bar' )
56+ expect ( component . find ( '.react-cards-namespace-cards' ) ) . to . have . length ( 1 )
5757 // 1 nav header card + 1 bar card
58- expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 2 )
59- } )
58+ expect ( component . find ( '.react-cards-namespace-cards .reactcards-card' ) ) . to . have . length ( 2 )
59+ } )
6060} )
0 commit comments