Skip to content

Commit 120d7ad

Browse files
nateabelechristopherthielen
authored andcommitted
fix(uiSrefActive): allow multiple classes
Fixes #2481, #2482
1 parent 500ecda commit 120d7ad

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/stateDirectivesSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,17 @@ describe('uiSrefActive', function() {
654654
expect(angular.element(template[0].querySelector('a')).attr('class')).toBe('active');
655655
}));
656656

657+
it('should allow multiple classes to be supplied', inject(function($rootScope, $q, $compile, $state) {
658+
template = $compile('<div><a ui-sref="contacts.item({ id: 1 })" ui-sref-active="active also-active">Contacts</a></div>')($rootScope);
659+
$rootScope.$digest();
660+
var a = angular.element(template[0].getElementsByTagName('a')[0]);
661+
662+
$state.transitionTo('contacts.item.edit', { id: 1 });
663+
$q.flush();
664+
timeoutFlush();
665+
expect(a.attr('class')).toMatch(/active also-active/);
666+
}));
667+
657668
describe('ng-{class,style} interface', function() {
658669
it('should match on abstract states that are included by the current state', inject(function($rootScope, $compile, $state, $q) {
659670
el = $compile('<div ui-sref-active="{active: \'admin.*\'}"><a ui-sref-active="active" ui-sref="admin.roles">Roles</a></div>')($rootScope);

0 commit comments

Comments
 (0)