Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 43535cf

Browse files
committed
chore(dropdown): remove class support
BREAKING CHANGE: Class support for consuming the directive has been removed. Please use an attribute instead
1 parent 12a37e0 commit 43535cf

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/dropdown/docs/demo.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<a href id="simple-dropdown" uib-dropdown-toggle>
66
Click me for a dropdown, yo!
77
</a>
8-
<ul class="uib-dropdown-menu" aria-labelledby="simple-dropdown">
8+
<ul uib-dropdown-menu aria-labelledby="simple-dropdown">
99
<li ng-repeat="choice in items">
1010
<a href>{{choice}}</a>
1111
</li>
@@ -17,7 +17,7 @@
1717
<button id="single-button" type="button" class="btn btn-primary" uib-dropdown-toggle ng-disabled="disabled">
1818
Button dropdown <span class="caret"></span>
1919
</button>
20-
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="single-button">
20+
<ul uib-dropdown-menu role="menu" aria-labelledby="single-button">
2121
<li role="menuitem"><a href="#">Action</a></li>
2222
<li role="menuitem"><a href="#">Another action</a></li>
2323
<li role="menuitem"><a href="#">Something else here</a></li>
@@ -33,7 +33,7 @@
3333
<span class="caret"></span>
3434
<span class="sr-only">Split button!</span>
3535
</button>
36-
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="split-button">
36+
<ul uib-dropdown-menu role="menu" aria-labelledby="split-button">
3737
<li role="menuitem"><a href="#">Action</a></li>
3838
<li role="menuitem"><a href="#">Another action</a></li>
3939
<li role="menuitem"><a href="#">Something else here</a></li>
@@ -47,7 +47,7 @@
4747
<button id="btn-append-to-body" type="button" class="btn btn-primary" uib-dropdown-toggle>
4848
Dropdown on Body <span class="caret"></span>
4949
</button>
50-
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="btn-append-to-body">
50+
<ul uib-dropdown-menu role="menu" aria-labelledby="btn-append-to-body">
5151
<li role="menuitem"><a href="#">Action</a></li>
5252
<li role="menuitem"><a href="#">Another action</a></li>
5353
<li role="menuitem"><a href="#">Something else here</a></li>
@@ -61,7 +61,7 @@
6161
<button id="button-template-url" type="button" class="btn btn-primary" uib-dropdown-toggle ng-disabled="disabled">
6262
Dropdown using template <span class="caret"></span>
6363
</button>
64-
<ul class="uib-dropdown-menu" template-url="dropdown.html" aria-labelledby="button-template-url">
64+
<ul uib-dropdown-menu template-url="dropdown.html" aria-labelledby="button-template-url">
6565
</ul>
6666
</div>
6767

@@ -77,7 +77,7 @@
7777
<button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" uib-dropdown-toggle>
7878
Dropdown with keyboard navigation <span class="caret"></span>
7979
</button>
80-
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="simple-btn-keyboard-nav">
80+
<ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav">
8181
<li role="menuitem"><a href="#">Action</a></li>
8282
<li role="menuitem"><a href="#">Another action</a></li>
8383
<li role="menuitem"><a href="#">Something else here</a></li>

src/dropdown/docs/readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This directive is composed by three parts:
66
* `uib-dropdown-toggle` which allows the dropdown to be toggled via click. This directive is optional.
77
* `uib-dropdown-menu` which transforms a node into the popup menu.
88

9+
Each of these parts need to be used as attribute directives.
10+
911
### uib-dropdown settings
1012

1113
* `append-to`

src/dropdown/dropdown.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
277277

278278
.directive('uibDropdownMenu', function() {
279279
return {
280-
restrict: 'AC',
280+
restrict: 'A',
281281
require: '?^uibDropdown',
282282
link: function(scope, element, attrs, dropdownCtrl) {
283283
if (!dropdownCtrl || angular.isDefined(attrs.dropdownNested)) {

src/dropdown/test/dropdown.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('uib-dropdown', function() {
188188
function dropdown() {
189189
$templateCache.put('custom.html', '<ul class="uib-dropdown-menu"><li>Item 1</li></ul>');
190190

191-
return $compile('<li uib-dropdown><a href uib-dropdown-toggle></a><ul class="uib-dropdown-menu" template-url="custom.html"></ul></li>')($rootScope);
191+
return $compile('<li uib-dropdown><a href uib-dropdown-toggle></a><ul uib-dropdown-menu template-url="custom.html"></ul></li>')($rootScope);
192192
}
193193

194194
beforeEach(function() {
@@ -210,7 +210,7 @@ describe('uib-dropdown', function() {
210210

211211
describe('using dropdown-append-to-body', function() {
212212
function dropdown() {
213-
return $compile('<li uib-dropdown dropdown-append-to-body><a href uib-dropdown-toggle></a><ul class="uib-dropdown-menu" id="dropdown-menu"><li><a href>Hello On Body</a></li></ul></li>')($rootScope);
213+
return $compile('<li uib-dropdown dropdown-append-to-body><a href uib-dropdown-toggle></a><ul uib-dropdown-menu id="dropdown-menu"><li><a href>Hello On Body</a></li></ul></li>')($rootScope);
214214
}
215215

216216
beforeEach(function() {
@@ -355,7 +355,7 @@ describe('uib-dropdown', function() {
355355
beforeEach(function() {
356356
$rootScope.toggleHandler = jasmine.createSpy('toggleHandler');
357357
$rootScope.isopen = false;
358-
element = $compile('<li uib-dropdown on-toggle="toggleHandler(open)" is-open="isopen"><a uib-dropdown-toggle></a><ul><li>Hello</li></ul></li>')($rootScope);
358+
element = $compile('<li uib-dropdown on-toggle="toggleHandler(open)" is-open="isopen"><a uib-dropdown-toggle></a><ul><li>Hello</li></ul></li>')($rootScope);
359359
$rootScope.$digest();
360360
});
361361

@@ -536,7 +536,7 @@ describe('uib-dropdown', function() {
536536
});
537537

538538
it('should work with dropdown-append-to-body', function() {
539-
element = $compile('<li uib-dropdown dropdown-append-to-body auto-close="outsideClick"><a href uib-dropdown-toggle></a><ul class="uib-dropdown-menu" id="dropdown-menu"><li><a href>Hello On Body</a></li></ul></li>')($rootScope);
539+
element = $compile('<li uib-dropdown dropdown-append-to-body auto-close="outsideClick"><a href uib-dropdown-toggle></a><ul uib-dropdown-menu id="dropdown-menu"><li><a href>Hello On Body</a></li></ul></li>')($rootScope);
540540
clickDropdownToggle();
541541
var dropdownMenu = $document.find('#dropdown-menu');
542542
expect(dropdownMenu.parent()).toHaveClass(dropdownConfig.appendToOpenClass);
@@ -661,7 +661,7 @@ describe('uib-dropdown', function() {
661661

662662
describe('with dropdown-append-to-body', function() {
663663
function dropdown() {
664-
return $compile('<li uib-dropdown dropdown-append-to-body keyboard-nav><a href uib-dropdown-toggle></a><ul class="uib-dropdown-menu" id="dropdown-menu"><li><a href>Hello On Body</a></li><li><a href>Hello Again</a></li></ul></li>')($rootScope);
664+
return $compile('<li uib-dropdown dropdown-append-to-body keyboard-nav><a href uib-dropdown-toggle></a><ul uib-dropdown-menu id="dropdown-menu"><li><a href>Hello On Body</a></li><li><a href>Hello Again</a></li></ul></li>')($rootScope);
665665
}
666666

667667
beforeEach(function() {

0 commit comments

Comments
 (0)