').appendTo(document.body);
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.interval = 5000;
scope.$apply();
});
afterEach(function() {
scope.$destroy();
+ elm.remove();
});
function testSlideActive(slideIndex) {
@@ -171,10 +173,10 @@ describe('carousel', function() {
testSlideActive(0);
$timeout.flush();
testSlideActive(1);
- elm.trigger('mouseenter');
+ elm.find('div.carousel').trigger('mouseenter');
expect($timeout.flush).toThrow();//pause should cancel current timeout
testSlideActive(1);
- elm.trigger('mouseleave');
+ elm.find('div.carousel').trigger('mouseleave');
$timeout.flush();
testSlideActive(2);
});
diff --git a/src/progressbar/docs/demo.html b/src/progressbar/docs/demo.html
index 8fbfb082f8..0b987b4f85 100644
--- a/src/progressbar/docs/demo.html
+++ b/src/progressbar/docs/demo.html
@@ -3,7 +3,7 @@
Static
Dynamic
diff --git a/src/progressbar/test/progressbar.spec.js b/src/progressbar/test/progressbar.spec.js
index 24889e26e7..634737fda5 100644
--- a/src/progressbar/test/progressbar.spec.js
+++ b/src/progressbar/test/progressbar.spec.js
@@ -1,3 +1,12 @@
+(function() {
+
+var getInlineWidth = function(element) {
+ var style = element.attr('style');
+ var width = /(^| )width: +([^;]+)(;|$)/i.exec(style)[2];
+
+ return width;
+};
+
describe('progressbar directive with no binding', function () {
var $rootScope, element;
beforeEach(module('ui.bootstrap.progressbar'));
@@ -19,7 +28,7 @@ describe('progressbar directive with no binding', function () {
});
it('has a "bar" element with expected width', function() {
- expect(element.children().eq(0).css('width')).toBe('22%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('22%');
});
});
@@ -45,23 +54,23 @@ describe('progressbar directive with data-binding', function () {
});
it('has a "bar" element with expected width', function() {
- expect(element.children().eq(0).css('width')).toBe('33%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('33%');
});
it('changes width when bind value changes', function() {
$rootScope.percent = 55;
$rootScope.$digest();
expect(element.children().length).toBe(1);
- expect(element.children().eq(0).css('width')).toBe('55%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('55%');
expect(element.children().eq(0).hasClass('bar')).toBe(true);
$rootScope.percent += 11;
$rootScope.$digest();
- expect(element.children().eq(0).css('width')).toBe('66%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('66%');
$rootScope.percent = 0;
$rootScope.$digest();
- expect(element.children().eq(0).css('width')).toBe('0%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('0%');
});
it('can handle correctly objects value && class', function() {
@@ -75,7 +84,7 @@ describe('progressbar directive with data-binding', function () {
expect(element.hasClass('progress')).toBe(true);
var barElement = element.children().eq(0);
- expect(barElement.css('width')).toBe('45%');
+ expect(getInlineWidth(barElement)).toBe('45%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-warning')).toBe(true);
});
@@ -106,9 +115,9 @@ describe('stacked progressbar directive', function () {
});
it('has a elements with expected width', function() {
- expect(element.children().eq(0).css('width')).toBe('12%');
- expect(element.children().eq(1).css('width')).toBe('22%');
- expect(element.children().eq(2).css('width')).toBe('33%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('12%');
+ expect(getInlineWidth(element.children().eq(1))).toBe('22%');
+ expect(getInlineWidth(element.children().eq(2))).toBe('33%');
});
it('changes width when bind value changes', function() {
@@ -116,9 +125,9 @@ describe('stacked progressbar directive', function () {
$rootScope.$digest();
expect(element.children().length).toBe(3);
- expect(element.children().eq(0).css('width')).toBe('12%');
- expect(element.children().eq(1).css('width')).toBe('35%');
- expect(element.children().eq(2).css('width')).toBe('33%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('12%');
+ expect(getInlineWidth(element.children().eq(1))).toBe('35%');
+ expect(getInlineWidth(element.children().eq(2))).toBe('33%');
});
it('can remove bars', function() {
@@ -127,8 +136,8 @@ describe('stacked progressbar directive', function () {
expect(element.children().length).toBe(2);
- expect(element.children().eq(0).css('width')).toBe('12%');
- expect(element.children().eq(1).css('width')).toBe('22%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('12%');
+ expect(getInlineWidth(element.children().eq(1))).toBe('22%');
});
it('can handle correctly object changes', function() {
@@ -143,17 +152,17 @@ describe('stacked progressbar directive', function () {
var barElement;
barElement = element.children().eq(0);
- expect(barElement.css('width')).toBe('12%');
+ expect(getInlineWidth(barElement)).toBe('12%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(false);
barElement = element.children().eq(1);
- expect(barElement.css('width')).toBe('29%');
+ expect(getInlineWidth(barElement)).toBe('29%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(true);
barElement = element.children().eq(2);
- expect(barElement.css('width')).toBe('33%');
+ expect(getInlineWidth(barElement)).toBe('33%');
expect(barElement.hasClass('bar')).toBe(true);
expect(barElement.hasClass('bar-danger')).toBe(false);
});
@@ -173,23 +182,23 @@ describe('stacked progressbar directive', function () {
var barElement;
barElement = element.children().eq(0);
- expect(barElement.css('width')).toBe('15%');
+ expect(getInlineWidth(barElement)).toBe('15%');
expect(barElement.hasClass('bar-info')).toBe(true);
barElement = element.children().eq(1);
- expect(barElement.css('width')).toBe('11%');
+ expect(getInlineWidth(barElement)).toBe('11%');
expect(barElement.hasClass('bar-info')).toBe(false);
barElement = element.children().eq(2);
- expect(barElement.css('width')).toBe('9%');
+ expect(getInlineWidth(barElement)).toBe('9%');
expect(barElement.hasClass('bar-danger')).toBe(true);
barElement = element.children().eq(3);
- expect(barElement.css('width')).toBe('22%');
+ expect(getInlineWidth(barElement)).toBe('22%');
expect(barElement.hasClass('bar-warning')).toBe(true);
barElement = element.children().eq(4);
- expect(barElement.css('width')).toBe('5%');
+ expect(getInlineWidth(barElement)).toBe('5%');
expect(barElement.hasClass('bar-warning')).toBe(false);
});
@@ -264,11 +273,11 @@ describe('stacked progressbar directive with auto-types', function () {
});
it('has elements with expected width', function() {
- expect(element.children().eq(0).css('width')).toBe('12%');
- expect(element.children().eq(1).css('width')).toBe('22%');
- expect(element.children().eq(2).css('width')).toBe('33%');
- expect(element.children().eq(3).css('width')).toBe('5%');
- expect(element.children().eq(4).css('width')).toBe('11%');
+ expect(getInlineWidth(element.children().eq(0))).toBe('12%');
+ expect(getInlineWidth(element.children().eq(1))).toBe('22%');
+ expect(getInlineWidth(element.children().eq(2))).toBe('33%');
+ expect(getInlineWidth(element.children().eq(3))).toBe('5%');
+ expect(getInlineWidth(element.children().eq(4))).toBe('11%');
});
it('has elements with automatic types', function() {
@@ -289,7 +298,7 @@ describe('stacked progressbar directive with auto-types', function () {
var stackedTypes = config.stackedTypes;
var bar = element.children().eq(1);
- expect(bar.css('width')).toBe('18%');
+ expect(getInlineWidth(bar)).toBe('18%');
expect(bar.hasClass('bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('bar-something')).toBe(true);
});
@@ -305,7 +314,7 @@ describe('stacked progressbar directive with auto-types', function () {
var stackedTypes = config.stackedTypes;
var bar = element.children().eq(1);
- expect(bar.css('width')).toBe('18%');
+ expect(getInlineWidth(bar)).toBe('18%');
expect(bar.hasClass('bar-' + stackedTypes[1])).toBe(false);
expect(bar.hasClass('bar-something')).toBe(true);
});
@@ -323,4 +332,6 @@ describe('stacked progressbar directive with auto-types', function () {
expect(element.children().eq(2).hasClass('bar-success')).toBe(true);
});
-});
\ No newline at end of file
+});
+
+})();
\ No newline at end of file
diff --git a/src/tabs/tabs.js b/src/tabs/tabs.js
index 2d3d0a5c62..64e042b511 100644
--- a/src/tabs/tabs.js
+++ b/src/tabs/tabs.js
@@ -134,6 +134,10 @@ function($parse, $http, $templateCache, $compile) {
};
}])
+// This comment is needed by the "ieshiv" grunt task to correctly build
+// the ieshiv file
+//.directive('tabHeading')
+
.directive('tabHeadingTransclude', [function() {
return {
restrict: 'A',
diff --git a/src/tabs/test/tabsSpec.js b/src/tabs/test/tabsSpec.js
index 74002e152f..d57897f2cd 100644
--- a/src/tabs/test/tabsSpec.js
+++ b/src/tabs/test/tabsSpec.js
@@ -23,10 +23,16 @@ describe('tabs', function() {
expect(c.eq(i).text().trim()).toEqual(contentsArray[i]);
}
}
+
+ function tagsToLower(html) {
+ return html.replace(/<[^>]+>|<\/[^>]+>/g, function (m) {
+ return m.toLowerCase();
+ });
+ }
describe('basics', function() {
-
+
beforeEach(inject(function($compile, $rootScope) {
scope = $rootScope.$new();
scope.first = '1';
@@ -34,22 +40,27 @@ describe('tabs', function() {
scope.actives = {};
scope.selectFirst = jasmine.createSpy();
scope.selectSecond = jasmine.createSpy();
- elm = $compile([
- '
',
- ' ',
- ' ',
- ' first content is {{first}}',
- ' ',
- ' ',
- ' Second Tab {{second}}',
- ' second content is {{second}}',
- ' ',
- ' ',
- '
'
- ].join('\n'))(scope);
+ elm = angular.element('
').appendTo(document.body);
+ var tpl = [
+ '
',
+ ' ',
+ ' first content is {{first}}',
+ ' ',
+ ' ',
+ ' Second Tab {{second}}',
+ ' second content is {{second}}',
+ ' ',
+ ''
+ ].join('\n');
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.$apply();
- return elm;
}));
+
+ afterEach(function() {
+ elm.remove();
+ elm = scope = undefined;
+ });
it('should create clickable titles', function() {
var t = titles();
@@ -57,7 +68,7 @@ describe('tabs', function() {
expect(t.find('a').eq(0).text()).toBe('First Tab 1');
//It should put the tab-heading element into the 'a' title
expect(t.find('a').eq(1).children().is('tab-heading')).toBe(true);
- expect(t.find('a').eq(1).children().html()).toBe('Second Tab 2');
+ expect(tagsToLower(t.find('a').eq(1).children().html())).toBe('Second Tab 2');
});
it('should bind tabs content and set first tab active', function() {
@@ -100,16 +111,24 @@ describe('tabs', function() {
scope.tabs = [
makeTab(), makeTab(), makeTab(), makeTab()
];
- elm = $compile([
+ elm = angular.element('').appendTo(document.body);
+ var tpl = [
'
',
' ',
' heading {{index}}',
' content {{$index}}',
' ',
''
- ].join('\n'))(scope);
+ ].join('\n');
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.$apply();
}));
+
+ afterEach(function() {
+ elm.remove();
+ elm = scope = undefined;
+ });
function titles() {
return elm.find('ul.nav-tabs li');
@@ -167,7 +186,8 @@ describe('tabs', function() {
scope = $rootScope.$new();
scope.myHtml = "
hello, there!";
scope.value = true;
- elm = $compile([
+ elm = angular.element('
').appendTo(document.body);
+ var tpl = [
'
',
' ',
' ',
@@ -177,16 +197,23 @@ describe('tabs', function() {
' 2
',
' 3
',
''
- ].join('\n'))(scope);
+ ].join('\n');
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.$apply();
}));
+
+ afterEach(function() {
+ elm.remove();
+ elm = scope = undefined;
+ });
function heading() {
return elm.find('ul li a').children();
}
it('should create a heading bound to myHtml', function() {
- expect(heading().eq(0).html()).toBe("
hello, there!");
+ expect(tagsToLower(heading().eq(0).html())).toBe("
hello, there!");
});
it('should hide and show the heading depending on value', function() {
@@ -215,7 +242,8 @@ describe('tabs', function() {
{ title:"Title 2", available:true },
{ title:"Title 3", available:true }
];
- elm = $compile([
+ elm = angular.element('
').appendTo(document.body);
+ var tpl = [
'
',
' ',
' div that makes troubles
',
@@ -236,12 +264,19 @@ describe('tabs', function() {
' yet another span that may do evil',
' ',
''
- ].join('\n'))(scope);
+ ].join('\n');
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.tabIsAvailable = function(tab) {
return tab.available;
};
}));
+
+ afterEach(function() {
+ elm.remove();
+ elm = scope = undefined;
+ });
it('should preserve correct ordering', function() {
function titles() {
@@ -354,11 +389,21 @@ describe('tabs', function() {
describe('remove', function() {
- it('should remove title tabs when elements are destroyed and change selection', inject(function($controller, $compile, $rootScope) {
+ beforeEach(inject(function($compile, $rootScope) {
scope = $rootScope.$new();
- elm = $compile("
Hellocontent {{i}}")(scope);
+ elm = angular.element('
').appendTo(document.body);
+ var tpl = "
Hellocontent {{i}}";
+ elm.html(tpl);
+ $compile(elm)(scope);
scope.$apply();
+ }));
+
+ afterEach(function() {
+ elm.remove();
+ elm = scope = undefined;
+ });
+ it('should remove title tabs when elements are destroyed and change selection', function() {
expectTitles(['1']);
expectContents(['Hello']);
@@ -376,6 +421,6 @@ describe('tabs', function() {
expect(titles().eq(2)).toHaveClass('active');
expect(contents().eq(2)).toHaveClass('active');
- }));
+ });
});
});
diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js
index 2d4f85b4fa..79a8b2ac9d 100644
--- a/src/tooltip/tooltip.js
+++ b/src/tooltip/tooltip.js
@@ -93,14 +93,14 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
var triggers = setTriggers( undefined );
var template =
- '<'+ directiveName +'-popup '+
+ '
'+
- ''+ directiveName +'-popup>';
+ '
';
return {
restrict: 'EA',
@@ -293,7 +293,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
.directive( 'tooltipPopup', function () {
return {
- restrict: 'E',
+ restrict: 'EA',
replace: true,
scope: { content: '@', placement: '@', animation: '&', isOpen: '&' },
templateUrl: 'template/tooltip/tooltip-popup.html'
@@ -306,7 +306,7 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
.directive( 'tooltipHtmlUnsafePopup', function () {
return {
- restrict: 'E',
+ restrict: 'EA',
replace: true,
scope: { content: '@', placement: '@', animation: '&', isOpen: '&' },
templateUrl: 'template/tooltip/tooltip-html-unsafe-popup.html'
diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js
index b69e4d5c9d..30ce05ba28 100644
--- a/src/typeahead/test/typeahead.spec.js
+++ b/src/typeahead/test/typeahead.spec.js
@@ -296,7 +296,7 @@ describe('typeahead tests', function () {
var element = prepareInputEl("
");
changeInputValueTo(element, 'fo');
- var matchHighlight = findMatches(element).find('a').html();
+ var matchHighlight = findMatches(element).find('a').html().toLowerCase();
expect(matchHighlight).toEqual('prefix
foo');
});
@@ -400,4 +400,4 @@ describe('typeahead tests', function () {
});
});
-});
\ No newline at end of file
+});
diff --git a/template/progressbar/progress.html b/template/progressbar/progress.html
index d390e79f7d..a2c0c99b42 100644
--- a/template/progressbar/progress.html
+++ b/template/progressbar/progress.html
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file