From 00c719cc62984a7815fcaa86793c84bb465686cd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lenglet Date: Fri, 19 Feb 2016 10:22:17 +0100 Subject: [PATCH] test(uiSelectDirective): Add test when merging ngClass attributes on uiSelect References PR #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 element --- test/select.spec.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/select.spec.js b/test/select.spec.js index 7c4018638..c265abae3 100644 --- a/test/select.spec.js +++ b/test/select.spec.js @@ -128,6 +128,7 @@ describe('ui-select tests', function() { if (attrs.appendToBody !== undefined) { attrsHtml += ' append-to-body="' + attrs.appendToBody + '"'; } if (attrs.allowClear !== undefined) { matchAttrsHtml += ' allow-clear="' + attrs.allowClear + '"';} if (attrs.inputId !== undefined) { attrsHtml += ' input-id="' + attrs.inputId + '"'; } + if (attrs.ngClass !== undefined) { attrsHtml += ' ng-class="' + attrs.ngClass + '"'; } } return compileTemplate( @@ -349,6 +350,14 @@ describe('ui-select tests', function() { expect(getMatchLabel(el)).toEqual('Adam'); }); + it('should merge both ng-class attributes defined on ui-select and its templates', function() { + var el = createUiSelect({ + ngClass: "{class: expression}" + }); + + expect($(el).attr('ng-class')).toEqual("{class: expression, open: $select.open}"); + }); + it('should correctly render initial state with track by feature', function() { var el = compileTemplate( ' \