Skip to content

Commit c47d1ed

Browse files
Fixes issue 575: change h1 to h4 styled as h1, update id="title" to id="empty-state-title-{{$id}}" to ensure unique titles, etc
1 parent a91312c commit c47d1ed

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

src/views/empty-state.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<div ng-if="$ctrl.config.icon" class="blank-slate-pf-icon">
33
<span class="{{$ctrl.config.icon}}"></span>
44
</div>
5-
<h1 id="title">
5+
<h4 id="empty-state-title-{{$id}}" class="h1 title">
66
{{$ctrl.config.title}}
7-
</h1>
8-
<p id="info" ng-if="$ctrl.config.info">
7+
</h4>
8+
<p id="empty-state-info-{{$id}}" class="info" ng-if="$ctrl.config.info">
99
{{$ctrl.config.info}}
1010
</p>
11-
<p id="helpLink" ng-if="$ctrl.config.helpLink">
11+
<p id="empty-state-helpLink-{{$id}}" class="helpLink" ng-if="$ctrl.config.helpLink">
1212
{{$ctrl.config.helpLink.label}} <a href="{{$ctrl.config.helpLink.url}}">{{$ctrl.config.helpLink.urlLabel}}</a>.
1313
</p>
1414
<div ng-if="$ctrl.hasMainActions()" class="blank-slate-pf-main-action">

test/notification/notification-drawer.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ describe('Component: pfNotificationDrawer', function () {
593593
var emptyStates = element.find('.blank-slate-pf');
594594
expect(emptyStates.length).toBe(1);
595595

596-
var title = angular.element(emptyStates[0]).find('#title').html();
596+
var title = angular.element(emptyStates[0]).find('.title').html();
597597
expect(_.trim(title)).toBe('There are no notifications to display.');
598598
});
599599

@@ -609,18 +609,18 @@ describe('Component: pfNotificationDrawer', function () {
609609
var emptyStates = element.find('.blank-slate-pf');
610610
expect(emptyStates.length).toBe(1);
611611

612-
var title = angular.element(emptyStates[0]).find('#title').html();
612+
var title = angular.element(emptyStates[0]).find('.title').html();
613613
expect(_.trim(title)).toBe('Nothing');
614614
});
615615

616616
it ('should show the empty state pattern when no notifications exist for a group', function() {
617617
var emptyStates = element.find('.blank-slate-pf');
618618
expect(emptyStates.length).toBe(2);
619619

620-
var title = angular.element(emptyStates[0]).find('#title').html();
620+
var title = angular.element(emptyStates[0]).find('.title').html();
621621
expect(_.trim(title)).toBe('There are no notifications to display.');
622622

623-
title = angular.element(emptyStates[1]).find('#title').html();
623+
title = angular.element(emptyStates[1]).find('.title').html();
624624
expect(_.trim(title)).toBe('Nothing');
625625
});
626626
});

test/table/tableview/table-view.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,21 @@ describe('Component: pfTableView', function () {
8585
basicSetup();
8686
$scope.items = null;
8787
$scope.$digest();
88-
expect(element.find('#title').text()).toContain('');
88+
expect(element.find('.title').text()).toContain('');
8989
});
9090

9191
it('should show the empty state when items is empty', function () {
9292
basicSetup();
9393
$scope.items = [];
9494
$scope.$digest();
95-
expect(element.find('#title').text()).toContain('No Items Available');
95+
expect(element.find('.title').text()).toContain('No Items Available');
9696
});
9797

9898
it('should show the empty state when the config property is specified', function () {
9999
basicSetup();
100100
$scope.config.itemsAvailable = false;
101101
$scope.$digest();
102-
expect(element.find('#title').text()).toContain('No Items Available');
102+
expect(element.find('.title').text()).toContain('No Items Available');
103103
});
104104

105105
it('should show the correct number of items', function () {

test/views/cardview/card-view.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ describe('Component: pfCardView', function () {
224224
it('should show the empty state when specified', function () {
225225
$scope.cardConfig.itemsAvailable = false;
226226
$scope.$digest();
227-
expect(element.find('#title').text()).toContain('No Items Available');
227+
expect(element.find('.title').text()).toContain('No Items Available');
228228
});
229229
})

test/views/empty-state.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('Component: pfEnptyState', function () {
1+
describe('Component: pfEmptyState', function () {
22
var $scope;
33
var $compile;
44
var element;
@@ -68,9 +68,9 @@ describe('Component: pfEnptyState', function () {
6868
compileHTML('<pf-empty-state config="config" action-buttons="actionButtons"></pf-empty-state>', $scope);
6969

7070
expect(element.find('.pficon-add-circle-o').length).toBe(1);
71-
expect(element.find('#title').text()).toContain('Empty State Title');
72-
expect(element.find('#info').text()).toContain('This is the Empty State component');
73-
expect(element.find('#helpLink').text()).toContain('For more information please see');
71+
expect(element.find('.title').text()).toContain('Empty State Title');
72+
expect(element.find('.info').text()).toContain('This is the Empty State component');
73+
expect(element.find('.helpLink').text()).toContain('For more information please see');
7474
expect(element.find('a').text()).toContain('pfExample');
7575
expect(element.find('a').prop('href')).toContain('#/api/patternfly.views.component:pfEmptyState');
7676

@@ -89,11 +89,11 @@ describe('Component: pfEnptyState', function () {
8989
it('should only display main default title when no config and actionButtons defined', function () {
9090
compileHTML('<pf-empty-state></pf-empty-state>', $scope);
9191

92-
expect(element.find('#title').text()).toContain('No Items Available');
92+
expect(element.find('.title').text()).toContain('No Items Available');
9393

9494
expect(element.find('.blank-slate-pf-icon').length).toBe(0);
95-
expect(element.find('#info').length).toBe(0);
96-
expect(element.find('#helpLink').length).toBe(0);
95+
expect(element.find('.info').length).toBe(0);
96+
expect(element.find('.helpLink').length).toBe(0);
9797
expect(element.find('button').length).toBe(0);
9898
});
9999
});

test/views/listview/list-view.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,6 @@ describe('Component: pfDataList', function () {
603603
it('should show the empty state when specified', function () {
604604
$scope.listConfig.itemsAvailable = false;
605605
$scope.$digest();
606-
expect(element.find('#title').text()).toContain('No Items Available');
606+
expect(element.find('.title').text()).toContain('No Items Available');
607607
});
608608
});

0 commit comments

Comments
 (0)