Skip to content

Commit

Permalink
Revert "feat(typeahead): add customClass support for dropdown"
Browse files Browse the repository at this point in the history
This reverts commit fa1cdfc.
  • Loading branch information
wesleycho authored and jasonaden committed Sep 30, 2015
1 parent 3b3f3f2 commit 740c15c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 45 deletions.
16 changes: 0 additions & 16 deletions src/typeahead/docs/demo.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
<style>
.dropdown-menu.demo-class {
border-radius: 0;
font-style: italic;
box-shadow: 5px 5px 0 rgba(0, 0, 0, .12);
}
.dropdown-menu.demo-class > .active > a,
.dropdown-menu.demo-class > .active > a:hover,
.dropdown-menu.demo-class > .active > a:focus {
background-color: rgba(247, 150, 4, .69);
}
</style>
<script type="text/ng-template" id="customTemplate.html">
<a>
<img ng-src="http://upload.wikimedia.org/wikipedia/commons/thumb/{{match.model.flag}}" width="16">
Expand All @@ -33,8 +21,4 @@ <h4>Asynchronous results</h4>
<h4>Custom templates for results</h4>
<pre>Model: {{customSelected | json}}</pre>
<input type="text" ng-model="customSelected" placeholder="Custom template" typeahead="state as state.name for state in statesWithFlags | filter:{name:$viewValue}" typeahead-template-url="customTemplate.html" class="form-control">

<h4>Custom class for append-to-body popup</h4>
<pre>Model: {{customClassSelected | json}}</pre>
<input type="text" ng-model="customClassSelected" typeahead-append-to-body="true" typeahead-dropdown-custom-class="demo-class" placeholder="Custom class" typeahead="state as state.name for state in statesWithFlags | filter:{name:$viewValue}" class="form-control">
</div>
6 changes: 1 addition & 5 deletions src/typeahead/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,5 @@ The typeahead directives provide several attributes:
On blur, select the currently highlighted match

* `typeahead-focus-on-select`
_(Defaults: true)_ :
_(Defaults: true) :
On selection, focus the input element the typeahead directive is associated with

* `typeahead-dropdown-custom-class`
_(Defaults: undefined)_ :
Add custom class to popup
19 changes: 0 additions & 19 deletions src/typeahead/test/typeahead.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,19 +595,6 @@ describe('typeahead tests', function() {
findMatches(element).eq(1).trigger('mouseenter');
expect(element).toBeOpenWithActive(2, 1);
});

it('should add a custom class to popup', function() {
var element = prepareInputEl('<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-dropdown-custom-class="demo-class"></div>');
changeInputValueTo(element, 'b');
expect(findDropDown(element).hasClass('demo-class')).toBeTruthy();
});

it('should add a custom class to popup with custom template', function() {
$templateCache.put('custom.html', '<div>foo</div>');
var element = prepareInputEl('<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-dropdown-custom-class="demo-class" typeahead-template-url="custom.html"></div>');
changeInputValueTo(element, 'b');
expect(findDropDown(element).hasClass('demo-class dropdown-menu')).toBeTruthy();
});
});

describe('promises', function() {
Expand Down Expand Up @@ -908,12 +895,6 @@ describe('typeahead tests', function() {
$timeout.flush();
expect(dropdown.css('top')).toEqual('500px');
});

it('should add a custom class to append-to-body popup', function() {
var element = prepareInputEl('<div><input ng-model="result" typeahead="item for item in source | filter:$viewValue" typeahead-append-to-body="true" typeahead-dropdown-custom-class="demo-class"></div>');
changeInputValueTo(element, 'b');
expect(findDropDown($document.find('body')).hasClass('demo-class')).toBeTruthy();
});
});

describe('focus first', function() {
Expand Down
5 changes: 0 additions & 5 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,6 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position'])
popUpEl.attr('popup-template-url', attrs.typeaheadPopupTemplateUrl);
}

// Add a custom class to Dropdown Menu element
if (angular.isDefined(attrs.typeaheadDropdownCustomClass)) {
popUpEl.addClass(attrs.typeaheadDropdownCustomClass);
}

var resetMatches = function() {
scope.matches = [];
scope.activeIdx = -1;
Expand Down

0 comments on commit 740c15c

Please sign in to comment.