Fixed tests for progressbar. Added .dropdown-item in typeahed default template
This commit is contained in:
+2
-2
@@ -5758,7 +5758,7 @@ Provide a set of defaults for certain tooltip and popover attributes. Currently
|
||||
</style>
|
||||
|
||||
<script type="text/ng-template" id="customTemplate.html">
|
||||
<a>
|
||||
<a class="dropdown-item">
|
||||
<img ng-src="http://upload.wikimedia.org/wikipedia/commons/thumb/{{match.model.flag}}" width="16">
|
||||
<span ng-bind-html="match.label | uibTypeaheadHighlight:query"></span>
|
||||
</a>
|
||||
@@ -5984,7 +5984,7 @@ Comprehension Angular expression (see <a href="http://docs.angularjs.org/api/ng.
|
||||
</style>
|
||||
|
||||
<script type="text/ng-template" id="customTemplate.html">
|
||||
<a>
|
||||
<a class="dropdown-item">
|
||||
<img ng-src="http://upload.wikimedia.org/wikipedia/commons/thumb/{{match.model.flag}}" width="16">
|
||||
<span ng-bind-html="match.label | uibTypeaheadHighlight:query"></span>
|
||||
</a>
|
||||
|
||||
@@ -330,7 +330,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.multiMap', 'ui.bootstrap.
|
||||
}
|
||||
|
||||
// original Bootstrap 4 dropdown sets openClass on both dropdownMenu and element
|
||||
$animate[toggleClass]($element, dropdownOpenClass);
|
||||
$animate[toggleClass]($element, dropdownOpenClass);
|
||||
|
||||
$animate[toggleClass](openContainer, dropdownOpenClass).then(function() {
|
||||
if (angular.isDefined(isOpen) && isOpen !== wasOpen) {
|
||||
|
||||
@@ -11,6 +11,8 @@ describe('progressbar directive', function() {
|
||||
}));
|
||||
|
||||
var BAR_CLASS = 'progress-bar';
|
||||
var BG_PREFIX = 'bg';
|
||||
var STRIPED_CLASS = 'progress-bar-striped';
|
||||
|
||||
function getBar(i) {
|
||||
return element.children().eq(i);
|
||||
@@ -156,7 +158,6 @@ describe('progressbar directive', function() {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('"type" attribute', function() {
|
||||
beforeEach(inject(function() {
|
||||
$rootScope.type = 'success';
|
||||
@@ -166,7 +167,7 @@ describe('progressbar directive', function() {
|
||||
|
||||
it('should use correct classes', function() {
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS);
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(0)).toHaveClass(BG_PREFIX + '-success');
|
||||
});
|
||||
|
||||
it('should change classes if type changed', function() {
|
||||
@@ -176,8 +177,31 @@ describe('progressbar directive', function() {
|
||||
|
||||
var barEl = getBar(0);
|
||||
expect(barEl).toHaveClass(BAR_CLASS);
|
||||
expect(barEl).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(barEl).toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(barEl).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(barEl).toHaveClass(BG_PREFIX + '-warning');
|
||||
});
|
||||
});
|
||||
|
||||
describe('"striped" attribute', function() {
|
||||
beforeEach(inject(function() {
|
||||
$rootScope.striped = true;
|
||||
element = $compile('<uib-progressbar value="value" striped="striped"></uib-progressbar>')($rootScope);
|
||||
$rootScope.$digest();
|
||||
}));
|
||||
|
||||
it('should use correct classes', function() {
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS);
|
||||
expect(getBar(0)).toHaveClass(STRIPED_CLASS);
|
||||
});
|
||||
|
||||
it('should change classes if striped changed', function() {
|
||||
$rootScope.striped = false;
|
||||
$rootScope.value += 1;
|
||||
$rootScope.$digest();
|
||||
|
||||
var barEl = getBar(0);
|
||||
expect(barEl).toHaveClass(BAR_CLASS);
|
||||
expect(barEl).not.toHaveClass(STRIPED_CLASS);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -206,14 +230,14 @@ describe('progressbar directive', function() {
|
||||
});
|
||||
|
||||
it('uses correct classes', function() {
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(0)).not.toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(0)).toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(0)).not.toHaveClass(BG_PREFIX + '-warning');
|
||||
|
||||
expect(getBar(1)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(1)).toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(1)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(1)).toHaveClass(BG_PREFIX + '-warning');
|
||||
|
||||
expect(getBar(2)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(2)).not.toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(2)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(2)).not.toHaveClass(BG_PREFIX + '-warning');
|
||||
});
|
||||
|
||||
it('should change classes if type changed', function() {
|
||||
@@ -224,15 +248,15 @@ describe('progressbar directive', function() {
|
||||
];
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(getBar(0)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(0)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(0)).toHaveClass(BG_PREFIX + '-warning');
|
||||
|
||||
expect(getBar(1)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(1)).not.toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(1)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(1)).not.toHaveClass(BG_PREFIX + '-warning');
|
||||
|
||||
expect(getBar(2)).toHaveClass(BAR_CLASS + '-info');
|
||||
expect(getBar(2)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(2)).not.toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(2)).toHaveClass(BG_PREFIX + '-info');
|
||||
expect(getBar(2)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(2)).not.toHaveClass(BG_PREFIX + '-warning');
|
||||
});
|
||||
|
||||
it('should change classes if type changed', function() {
|
||||
@@ -243,9 +267,9 @@ describe('progressbar directive', function() {
|
||||
|
||||
expect(element.children().length).toBe(1);
|
||||
|
||||
expect(getBar(0)).toHaveClass(BAR_CLASS + '-info');
|
||||
expect(getBar(0)).not.toHaveClass(BAR_CLASS + '-success');
|
||||
expect(getBar(0)).not.toHaveClass(BAR_CLASS + '-warning');
|
||||
expect(getBar(0)).toHaveClass(BG_PREFIX + '-info');
|
||||
expect(getBar(0)).not.toHaveClass(BG_PREFIX + '-success');
|
||||
expect(getBar(0)).not.toHaveClass(BG_PREFIX + '-warning');
|
||||
});
|
||||
|
||||
it('should have the correct aria markup', function() {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</style>
|
||||
|
||||
<script type="text/ng-template" id="customTemplate.html">
|
||||
<a>
|
||||
<a class="dropdown-item">
|
||||
<img ng-src="http://upload.wikimedia.org/wikipedia/commons/thumb/{{match.model.flag}}" width="16">
|
||||
<span ng-bind-html="match.label | uibTypeaheadHighlight:query"></span>
|
||||
</a>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<a href
|
||||
tabindex="-1"
|
||||
class="dropdown-item"
|
||||
ng-bind-html="match.label | uibTypeaheadHighlight:query"
|
||||
ng-attr-title="{{match.label}}"></a>
|
||||
|
||||
Reference in New Issue
Block a user