diff --git a/src/accordion/accordion.js b/src/accordion/accordion.js
index 8e6f870f2b..e3e7b4c731 100644
--- a/src/accordion/accordion.js
+++ b/src/accordion/accordion.js
@@ -1,10 +1,10 @@
angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
-.constant('accordionConfig', {
+.constant('uibAccordionConfig', {
closeOthers: true
})
-.controller('AccordionController', ['$scope', '$attrs', 'accordionConfig', function($scope, $attrs, accordionConfig) {
+.controller('UibAccordionController', ['$scope', '$attrs', 'uibAccordionConfig', function($scope, $attrs, accordionConfig) {
// This array keeps track of the accordion groups
this.groups = [];
@@ -43,10 +43,10 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
// The accordion directive simply sets up the directive controller
// and adds an accordion CSS class to itself element.
-.directive('accordion', function() {
+.directive('uibAccordion', function() {
return {
restrict: 'EA',
- controller: 'AccordionController',
+ controller: 'UibAccordionController',
controllerAs: 'accordion',
transclude: true,
replace: false,
@@ -57,9 +57,9 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
})
// The accordion-group directive indicates a block of html that will expand and collapse in an accordion
-.directive('accordionGroup', function() {
+.directive('uibAccordionGroup', function() {
return {
- require: '^accordion', // We need this directive to be inside an accordion
+ require: '^uibAccordion', // We need this directive to be inside an accordion
restrict: 'EA',
transclude: true, // It transcludes the contents of the directive into the template
replace: true, // The element containing the directive will be replaced with the template
@@ -103,13 +103,13 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
//
// Heading containing HTML -
//
-.directive('accordionHeading', function() {
+.directive('uibAccordionHeading', function() {
return {
restrict: 'EA',
transclude: true, // Grab the contents to be used as the heading
template: '', // In effect remove this element!
replace: true,
- require: '^accordionGroup',
+ require: '^uibAccordionGroup',
link: function(scope, element, attr, accordionGroupCtrl, transclude) {
// Pass the heading to the accordion-group controller
// so that it can be transcluded into the right place in the template
@@ -125,11 +125,12 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
//
-
-
+
+
This content is straight in the template.
-
-
+
+
{{group.content}}
-
-
-
The body of the accordion group grows to fit the contents
+
+
+
The body of the uib-accordion group grows to fit the contents
{{item}}
-
-
+
+
Hello
-
-
+
+
Please, to delete your account, click the button below
-
-
-
+
+
+
I can have markup, too!
-
+
This is just some content to illustrate fancy headings.
-
-
+
+
diff --git a/src/accordion/docs/readme.md b/src/accordion/docs/readme.md
index c4dcd23de8..4af9f8d2b3 100644
--- a/src/accordion/docs/readme.md
+++ b/src/accordion/docs/readme.md
@@ -2,14 +2,14 @@ The **accordion directive** builds on top of the collapse directive to provide a
The body of each accordion group is transcluded into the body of the collapsible element.
-### Accordion Settings
+### uib-accordion Settings
* `close-others` (Defaults: false) :
Control whether expanding an item will cause the other items to close
* `template-url` (Defaults: `template/accordion/accordion.html`) :
Add the ability to override the template used on the component.
-### Accordion Group Settings
+### uib-accordion Group Settings
* `is-disabled` (Defaults: false) :
Whether the accordion group is disabled or not.
@@ -24,4 +24,4 @@ The body of each accordion group is transcluded into the body of the collapsible
### Accordion heading
-Instead of the `heading` attribute on the `accordion-group`, you can use an `accordion-heading` element inside a group that will be used as the group's header.
+Instead of the `heading` attribute on the `uib-accordion-group`, you can use an `uib-accordion-heading` element inside a group that will be used as the group's header.
diff --git a/src/accordion/test/accordion.spec.js b/src/accordion/test/accordion.spec.js
index 4cd881b188..90dca81cc6 100644
--- a/src/accordion/test/accordion.spec.js
+++ b/src/accordion/test/accordion.spec.js
@@ -1,4 +1,4 @@
-describe('accordion', function() {
+describe('uib-accordion', function() {
var $animate, $scope;
beforeEach(module('ui.bootstrap.accordion'));
@@ -17,7 +17,7 @@ describe('accordion', function() {
var ctrl, $element, $attrs;
beforeEach(inject(function($controller) {
$attrs = {}; $element = {};
- ctrl = $controller('AccordionController', { $scope: $scope, $element: $element, $attrs: $attrs });
+ ctrl = $controller('UibAccordionController', { $scope: $scope, $element: $element, $attrs: $attrs });
}));
describe('addGroup', function() {
@@ -64,13 +64,13 @@ describe('accordion', function() {
describe('setting accordionConfig', function() {
var originalCloseOthers;
- beforeEach(inject(function(accordionConfig) {
- originalCloseOthers = accordionConfig.closeOthers;
- accordionConfig.closeOthers = false;
+ beforeEach(inject(function(uibAccordionConfig) {
+ originalCloseOthers = uibAccordionConfig.closeOthers;
+ uibAccordionConfig.closeOthers = false;
}));
- afterEach(inject(function(accordionConfig) {
+ afterEach(inject(function(uibAccordionConfig) {
// return it to the original value
- accordionConfig.closeOthers = originalCloseOthers;
+ uibAccordionConfig.closeOthers = originalCloseOthers;
}));
it('should not close other panels if accordionConfig.closeOthers is false', function() {
@@ -104,7 +104,7 @@ describe('accordion', function() {
});
});
- describe('accordion', function() {
+ describe('uib-accordion', function() {
var scope, $compile, $templateCache, element;
beforeEach(inject(function($rootScope, _$compile_, _$templateCache_) {
@@ -116,10 +116,10 @@ describe('accordion', function() {
it('should expose the controller on the view', function() {
$templateCache.put('template/accordion/accordion.html', '
{{accordion.text}}
');
- element = $compile('')(scope);
+ element = $compile('')(scope);
scope.$digest();
- var ctrl = element.controller('accordion');
+ var ctrl = element.controller('uibAccordion');
expect(ctrl).toBeDefined();
ctrl.text = 'foo';
@@ -137,7 +137,7 @@ describe('accordion', function() {
});
});
- describe('accordion-group', function() {
+ describe('uib-accordion-group', function() {
var scope, $compile;
var element, groups;
@@ -161,9 +161,9 @@ describe('accordion', function() {
$templateCache.put('foo/bar.html', '
' +
+ 'Static content' +
+ '';
element = angular.element(tpl);
scope.items = ['Item 1', 'Item 2', 'Item 3'];
scope.open1 = true;
@@ -377,9 +377,9 @@ describe('accordion', function() {
describe('is-open attribute with dynamic groups', function() {
beforeEach(function() {
var tpl =
- '' +
- '{{group.content}}' +
- '';
+ '' +
+ '{{group.content}}' +
+ '';
element = angular.element(tpl);
scope.groups = [
{name: 'title 1', content: 'Content 1', open: false},
@@ -413,9 +413,9 @@ describe('accordion', function() {
var groupBody;
beforeEach(function() {
var tpl =
- '' +
- 'Content 1' +
- '';
+ '' +
+ 'Content 1' +
+ '';
element = angular.element(tpl);
scope.disabled = true;
$compile(element)(scope);
@@ -449,15 +449,15 @@ describe('accordion', function() {
});
});
- // This is re-used in both the accordion-heading element and the accordion-heading attribute tests
+ // This is re-used in both the uib-accordion-heading element and the uib-accordion-heading attribute tests
function isDisabledStyleCheck() {
var tpl =
- '' +
- '' +
- 'Heading Element {{x}}' +
+ '' +
+ '' +
+ 'Heading Element {{x}}' +
'Body' +
- '' +
- '';
+ '' +
+ '';
scope.disabled = true;
element = $compile(tpl)(scope);
scope.$digest();
@@ -466,21 +466,21 @@ describe('accordion', function() {
expect(findGroupLink(0).find('span').hasClass('text-muted')).toBe(true);
}
- describe('accordion-heading element', function() {
+ describe('uib-accordion-heading element', function() {
beforeEach(function() {
var tpl =
- '' +
- '' +
- 'Heading Element {{x}}' +
+ '' +
+ '' +
+ 'Heading Element {{x}}' +
'Body' +
- '' +
- '';
+ '' +
+ '';
element = $compile(tpl)(scope);
scope.$digest();
groups = element.find('.panel');
});
- it('transcludes the content into the heading link', function() {
+ it('transcludes the content into the heading link', function() {
expect(findGroupLink(0).text()).toBe('Heading Element 123 ');
});
@@ -496,21 +496,21 @@ describe('accordion', function() {
});
- describe('accordion-heading attribute', function() {
+ describe('uib-accordion-heading attribute', function() {
beforeEach(function() {
var tpl =
- '' +
- '' +
- '
Heading Element {{x}}
' +
+ '' +
+ '' +
+ '
Heading Element {{x}}
' +
'Body' +
- '' +
- '';
+ '' +
+ '';
element = $compile(tpl)(scope);
scope.$digest();
groups = element.find('.panel');
});
- it('transcludes the content into the heading link', function() {
+ it('transcludes the content into the heading link', function() {
expect(findGroupLink(0).text()).toBe('Heading Element 123 ');
});
@@ -522,9 +522,9 @@ describe('accordion', function() {
});
- describe('accordion-heading, with repeating accordion-groups', function() {
- it('should clone the accordion-heading for each group', function() {
- element = $compile('{{x}}')(scope);
+ describe('uib-accordion-heading, with repeating uib-accordion-groups', function() {
+ it('should clone the uib-accordion-heading for each group', function() {
+ element = $compile('{{x}}')(scope);
scope.$digest();
groups = element.find('.panel');
expect(groups.length).toBe(3);
@@ -534,9 +534,9 @@ describe('accordion', function() {
});
});
- describe('accordion-heading attribute, with repeating accordion-groups', function() {
- it('should clone the accordion-heading for each group', function() {
- element = $compile('
{{x}}
')(scope);
+ describe('uib-accordion-heading attribute, with repeating uib-accordion-groups', function() {
+ it('should clone the uib-accordion-heading for each group', function() {
+ element = $compile('
{{x}}
')(scope);
scope.$digest();
groups = element.find('.panel');
expect(groups.length).toBe(3);
@@ -546,21 +546,21 @@ describe('accordion', function() {
});
});
- describe('accordion group panel class - #3968', function() {
+ describe('uib-accordion group panel class - #3968', function() {
it('should use the default value when panel class is falsy', function() {
- element = $compile('Content')(scope);
+ element = $compile('Content')(scope);
scope.$digest();
groups = element.find('.panel');
expect(groups.eq(0)).toHaveClass('panel-default');
- element = $compile('Content')(scope);
+ element = $compile('Content')(scope);
scope.$digest();
groups = element.find('.panel');
expect(groups.eq(0)).toHaveClass('panel-default');
});
it('should use the specified value when not falsy', function() {
- element = $compile('Content')(scope);
+ element = $compile('Content')(scope);
scope.$digest();
groups = element.find('.panel');
expect(groups.eq(0)).toHaveClass('custom-class');
@@ -569,3 +569,52 @@ describe('accordion', function() {
});
});
});
+
+/* Deprecation tests below */
+
+describe('accordion deprecation', function() {
+ beforeEach(module('ui.bootstrap.accordion'));
+ beforeEach(module('ngAnimateMock'));
+ beforeEach(module('template/accordion/accordion.html'));
+ beforeEach(module('template/accordion/accordion-group.html'));
+
+ it('should suppress warning', function() {
+ module(function($provide) {
+ $provide.value('$accordionSuppressWarning', true);
+ });
+
+ inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element =
+ '' +
+ '' +
+ '
Heading Element {{x}}
' +
+ 'Body' +
+ '' +
+ '';
+ element = $compile(element)($rootScope);
+ $rootScope.$digest();
+ expect($log.warn.calls.count()).toBe(0);
+ });
+ });
+
+ it('should give warning by default', inject(function($compile, $log, $rootScope) {
+ spyOn($log, 'warn');
+
+ var element =
+ '' +
+ '' +
+ '
Heading Element {{x}}
' +
+ 'Body' +
+ '' +
+ '';
+ element = $compile(element)($rootScope);
+ $rootScope.$digest();
+
+ expect($log.warn.calls.count()).toBe(3);
+ expect($log.warn.calls.argsFor(0)).toEqual(['accordion-heading is now deprecated. Use uib-accordion-heading instead.']);
+ expect($log.warn.calls.argsFor(1)).toEqual(['accordion-group is now deprecated. Use uib-accordion-group instead.']);
+ expect($log.warn.calls.argsFor(2)).toEqual(['accordion is now deprecated. Use uib-accordion instead.']);
+ }));
+});
diff --git a/template/accordion/accordion-group.html b/template/accordion/accordion-group.html
index 0753b01e52..1dc4c8e785 100644
--- a/template/accordion/accordion-group.html
+++ b/template/accordion/accordion-group.html
@@ -1,10 +1,10 @@