@@ -3,7 +3,7 @@ import {FlexCol} from '../../../src/react/flex-grids';
33import { Header } from '../../../src/react/siteframe/header' ;
44
55describe ( 'Header' , ( ) => {
6- describe ( 'without required props props ' , ( ) => {
6+ describe ( 'with a string companyName ' , ( ) => {
77 beforeEach ( ( ) => {
88 ReactDOM . render ( < Header { ...{ companyName : 'Pivotal' } } /> , root ) ;
99 } ) ;
@@ -23,6 +23,26 @@ describe('Header', () => {
2323 } ) ;
2424 } ) ;
2525
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+
2646 describe ( 'with props' , ( ) => {
2747 let companyName , onClick , logoSrc , productName , cols , logo ;
2848
@@ -31,7 +51,7 @@ describe('Header', () => {
3151 onClick = jasmine . createSpy ( 'onClick' ) ;
3252 logoSrc = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ;
3353 logo = < a { ...{ onClick} } > < img src = { logoSrc } /> </ a > ;
34- productName = ' some-product-name' ;
54+ productName = < a href = "#" > some-product-name</ a > ;
3555 cols = [ < FlexCol > first custom column</ FlexCol > , < FlexCol > second custom column</ FlexCol > ] ;
3656
3757 ReactDOM . render ( < Header { ...{ cols, companyName, logo, productName} } /> , root ) ;
@@ -50,9 +70,7 @@ describe('Header', () => {
5070 it ( 'renders a fixed second column with the company and product names' , ( ) => {
5171 expect ( '.pui-siteframe-header .col:eq(1)' ) . toHaveClass ( 'col-fixed' ) ;
5272 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' ) ;
5674 } ) ;
5775
5876 it ( 'renders the first custom column' , ( ) => {
0 commit comments