1- describe ( 'Directive : pfCard' , function ( ) {
1+ describe ( 'Component : pfCard' , function ( ) {
22 var $scope , $compile , element , headTitle , subTitle , cardClass , innerContent , isoScope ;
33
44 beforeEach ( module (
@@ -12,18 +12,18 @@ describe('Directive: pfCard', function() {
1212 $scope = _$rootScope_ ;
1313 } ) ) ;
1414
15- describe ( 'Page with pf-card directive ' , function ( ) {
15+ describe ( 'Page with pf-card component ' , function ( ) {
1616
1717 var compileCard = function ( markup , scope ) {
1818 var el = $compile ( markup ) ( scope ) ;
1919 scope . $digest ( ) ;
20- isoScope = el . isolateScope ( ) ;
20+ isoScope = el . controller ( "pf-card" ) ;
2121 return el ;
2222 } ;
2323
2424 it ( "should set the headTitle and subTitle and inner content" , function ( ) {
2525
26- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title"><span>Inner content goes here</span></div >' , $scope ) ;
26+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title"><span>Inner content goes here</span></pf-card >' , $scope ) ;
2727
2828 headTitle = angular . element ( element ) . find ( '.card-pf-title' ) . html ( ) ;
2929 expect ( headTitle ) . toBe ( "My card title" ) ;
@@ -42,7 +42,7 @@ describe('Directive: pfCard', function() {
4242
4343 it ( "should show the top border" , function ( ) {
4444
45- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title" show-top-border="true">Inner content goes here</div >' , $scope ) ;
45+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title" show-top-border="true">Inner content goes here</pf-card >' , $scope ) ;
4646
4747 // showTopBorder set to true, results in having the .card-pf-accented class
4848 cardClass = angular . element ( element ) . find ( '.card-pf' ) . hasClass ( 'card-pf-accented' ) ;
@@ -63,21 +63,21 @@ describe('Directive: pfCard', function() {
6363 it ( "should show and hide the bottom border" , function ( ) {
6464
6565 // by default, bottom border should be shown
66- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</div >' , $scope ) ;
66+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card >' , $scope ) ;
6767 cardClass = angular . element ( element ) . find ( '.card-pf-heading' ) ;
6868 expect ( cardClass . size ( ) ) . toBe ( 1 ) ;
6969 cardClass = angular . element ( element ) . find ( '.card-pf-heading-no-bottom' ) ;
7070 expect ( cardClass . size ( ) ) . toBe ( 0 ) ;
7171
7272 // setting to false should hide the bottom border
73- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="false">Inner content goes here</div >' , $scope ) ;
73+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="false">Inner content goes here</pf-card >' , $scope ) ;
7474 cardClass = angular . element ( element ) . find ( '.card-pf-heading' ) ;
7575 expect ( cardClass . size ( ) ) . toBe ( 0 ) ;
7676 cardClass = angular . element ( element ) . find ( '.card-pf-heading-no-bottom' ) ;
7777 expect ( cardClass . size ( ) ) . toBe ( 1 ) ;
7878
7979 // setting to true should show the bottom border
80- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="true">Inner content goes here</div >' , $scope ) ;
80+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title" show-titles-separator="true">Inner content goes here</pf-card >' , $scope ) ;
8181 cardClass = angular . element ( element ) . find ( '.card-pf-heading' ) ;
8282 expect ( cardClass . size ( ) ) . toBe ( 1 ) ;
8383 cardClass = angular . element ( element ) . find ( '.card-pf-heading-no-bottom' ) ;
@@ -88,7 +88,7 @@ describe('Directive: pfCard', function() {
8888 it ( "should hide the action bar footer by default" , function ( ) {
8989
9090 // by default, if footer not defined, footer should not be shown
91- element = compileCard ( '<div pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</div >' , $scope ) ;
91+ element = compileCard ( '<pf-card head-title="My card title" sub-title="My card subtitle title">Inner content goes here</pf-card >' , $scope ) ;
9292 cardClass = angular . element ( element ) . find ( '.card-pf-footer' ) ;
9393 expect ( cardClass . size ( ) ) . toBe ( 0 ) ;
9494 } ) ;
@@ -102,7 +102,7 @@ describe('Directive: pfCard', function() {
102102 'text' : 'Add New Cluster'
103103 } ;
104104
105- element = compileCard ( '<div pf-card head-title="title" footer="actionBarConfig">Inner content</div >' , $scope ) ;
105+ element = compileCard ( '<pf-card head-title="title" footer="actionBarConfig">Inner content</pf-card >' , $scope ) ;
106106 cardClass = angular . element ( element ) . find ( 'a' ) ;
107107 expect ( cardClass . attr ( 'href' ) ) . toBe ( '#addCluster' ) ;
108108 var spans = cardClass . find ( 'span' ) ;
@@ -119,7 +119,7 @@ describe('Directive: pfCard', function() {
119119 }
120120 } ;
121121
122- element = compileCard ( '<div pf-card head-title="title" footer="actionBarConfig">Inner content</div >' , $scope ) ;
122+ element = compileCard ( '<pf-card head-title="title" footer="actionBarConfig">Inner content</pf-card >' , $scope ) ;
123123 cardClass = angular . element ( element ) . find ( 'a' ) ;
124124 expect ( cardClass . attr ( 'href' ) ) . toBeUndefined ( ) ;
125125
@@ -143,7 +143,7 @@ describe('Directive: pfCard', function() {
143143 'text' : 'Add New Cluster'
144144 } ;
145145
146- element = compileCard ( '<div pf-card head-title="title" footer="actionBarConfig">Inner content</div >' , $scope ) ;
146+ element = compileCard ( '<pf-card head-title="title" footer="actionBarConfig">Inner content</pf-card >' , $scope ) ;
147147 cardClass = angular . element ( element ) . find ( '.card-pf-footer' ) . find ( 'button' ) ;
148148 expect ( cardClass . size ( ) ) . toBe ( 0 ) ;
149149 } ) ;
@@ -160,7 +160,7 @@ describe('Directive: pfCard', function() {
160160 'defaultFilter' : 2
161161 } ;
162162
163- element = compileCard ( '<div pf-card head-title="title" footer="{}" filter="filterConfig">Inner content</div >' , $scope ) ;
163+ element = compileCard ( '<pf-card head-title="title" footer="{}" filter="filterConfig">Inner content</pf-card >' , $scope ) ;
164164
165165 // should find 3 filters
166166 cardClass = angular . element ( element ) . find ( '.card-pf-footer' ) . find ( 'a' ) ;
@@ -192,7 +192,7 @@ describe('Directive: pfCard', function() {
192192 'position' : 'header'
193193 } ;
194194
195- element = compileCard ( '<div pf-card head-title="title" footer="{}" filter="filterConfig">Inner content</div >' , $scope ) ;
195+ element = compileCard ( '<pf-card pf-card head-title="title" footer="{}" filter="filterConfig">Inner content</pf-card >' , $scope ) ;
196196
197197 // should NOT find any filters in the footer
198198 cardClass = angular . element ( element ) . find ( '.card-pf-footer' ) . find ( 'a' ) ;
@@ -217,7 +217,7 @@ describe('Directive: pfCard', function() {
217217
218218 it ( "should not show the header if no title or filter specified" , function ( ) {
219219
220- element = compileCard ( '<div pf-card>Inner content</div >' , $scope ) ;
220+ element = compileCard ( '<pf-card>Inner content</pf-card >' , $scope ) ;
221221
222222 // should NOT find any header artifacts
223223 cardClass = angular . element ( element ) . find ( '.card-pf-heading' ) ;
0 commit comments