Skip to content

Commit 00c719c

Browse files
author
Jean-Baptiste Lenglet
committed
test(uiSelectDirective): Add test when merging ngClass attributes on uiSelect
References PR angular-ui#1447 - Add missing test on uiSelect when merging ngClass attributes between DOM declaration and template - Add one property `attrs.ngClass` in `createUiSelect(attrs)` to append a `ng-class` attribute to the <ui-select> element
1 parent 3b1496c commit 00c719c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/select.spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ describe('ui-select tests', function() {
128128
if (attrs.appendToBody !== undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; }
129129
if (attrs.allowClear !== undefined) { matchAttrsHtml += ' allow-clear="' + attrs.allowClear + '"';}
130130
if (attrs.inputId !== undefined) { attrsHtml += ' input-id="' + attrs.inputId + '"'; }
131+
if (attrs.ngClass !== undefined) { attrsHtml += ' ng-class="' + attrs.ngClass + '"'; }
131132
}
132133

133134
return compileTemplate(
@@ -349,6 +350,14 @@ describe('ui-select tests', function() {
349350
expect(getMatchLabel(el)).toEqual('Adam');
350351
});
351352

353+
it('should merge both ng-class attributes defined on ui-select and its templates', function() {
354+
var el = createUiSelect({
355+
ngClass: "{class: expression}"
356+
});
357+
358+
expect($(el).attr('ng-class')).toEqual("{class: expression, open: $select.open}");
359+
});
360+
352361
it('should correctly render initial state with track by feature', function() {
353362
var el = compileTemplate(
354363
'<ui-select ng-model="selection.selected"> \

0 commit comments

Comments
 (0)