@@ -3,7 +3,7 @@ import {FlexCol} from '../../../src/react/flex-grids';
3
3
import { Header } from '../../../src/react/siteframe/header' ;
4
4
5
5
describe ( 'Header' , ( ) => {
6
- describe ( 'without required props props ' , ( ) => {
6
+ describe ( 'with a string companyName ' , ( ) => {
7
7
beforeEach ( ( ) => {
8
8
ReactDOM . render ( < Header { ...{ companyName : 'Pivotal' } } /> , root ) ;
9
9
} ) ;
@@ -23,6 +23,26 @@ describe('Header', () => {
23
23
} ) ;
24
24
} ) ;
25
25
26
+ describe ( 'with a node companyName' , ( ) => {
27
+ beforeEach ( ( ) => {
28
+ ReactDOM . render ( < Header { ...{ companyName : < a href = "#" > Pivotal</ a > } } /> , root ) ;
29
+ } ) ;
30
+
31
+ it ( 'renders a grid with one column' , ( ) => {
32
+ expect ( '.pui-siteframe-header' ) . toHaveClass ( 'grid' ) ;
33
+ expect ( '.pui-siteframe-header > .col' ) . toHaveLength ( 1 ) ;
34
+ } ) ;
35
+
36
+ it ( 'renders a fixed column with the company name' , ( ) => {
37
+ expect ( '.pui-siteframe-header .col:eq(0)' ) . toHaveClass ( 'col-fixed' ) ;
38
+ expect ( '.pui-siteframe-header .col:eq(0) h4 a' ) . toContainText ( 'Pivotal' ) ;
39
+ } ) ;
40
+
41
+ it ( 'does not render a span containing the product name' , ( ) => {
42
+ expect ( '.pui-siteframe-header .col:eq(0) h4 span' ) . not . toExist ( ) ;
43
+ } ) ;
44
+ } ) ;
45
+
26
46
describe ( 'with props' , ( ) => {
27
47
let companyName , onClick , logoSrc , productName , cols , logo ;
28
48
@@ -31,7 +51,7 @@ describe('Header', () => {
31
51
onClick = jasmine . createSpy ( 'onClick' ) ;
32
52
logoSrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ;
33
53
logo = < a { ...{ onClick} } > < img src = { logoSrc } /> </ a > ;
34
- productName = ' some-product-name' ;
54
+ productName = < a href = "#" > some-product-name</ a > ;
35
55
cols = [ < FlexCol > first custom column</ FlexCol > , < FlexCol > second custom column</ FlexCol > ] ;
36
56
37
57
ReactDOM . render ( < Header { ...{ cols, companyName, logo, productName} } /> , root ) ;
@@ -50,9 +70,7 @@ describe('Header', () => {
50
70
it ( 'renders a fixed second column with the company and product names' , ( ) => {
51
71
expect ( '.pui-siteframe-header .col:eq(1)' ) . toHaveClass ( 'col-fixed' ) ;
52
72
expect ( '.pui-siteframe-header .col:eq(1) h4' ) . toContainText ( companyName ) ;
53
- expect ( '.pui-siteframe-header .col:eq(1) h4 .em-high' ) . toHaveText ( productName ) ;
54
- expect ( '.pui-siteframe-header .col:eq(1) span' ) . toHaveClass ( 'em-high' ) ;
55
- expect ( '.pui-siteframe-header .col:eq(1) span' ) . toHaveText ( productName ) ;
73
+ expect ( '.pui-siteframe-header .col:eq(1) h4 span.em-high a' ) . toHaveText ( 'some-product-name' ) ;
56
74
} ) ;
57
75
58
76
it ( 'renders the first custom column' , ( ) => {
0 commit comments