Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
feat(autocomplete): allow disabling asterisk on floating label
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion committed Feb 10, 2016
1 parent 437a308 commit 65fa722
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/autocomplete/autocomplete.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,27 @@ describe('<md-autocomplete>', function() {

element.remove();
});

it('should forward the md-no-asterisk attribute', function() {
var scope = createScope();
var template = '\
<md-autocomplete\
md-selected-item="selectedItem"\
md-search-text="searchText"\
md-items="item in match(searchText)"\
md-item-text="item.display"\
md-min-length="0" \
required\
md-no-asterisk="true"\
md-floating-label="Asterisk Label">\
<span md-highlight-text="searchText">{{item.display}}</span>\
</md-autocomplete>';
var element = compile(template, scope);
var input = element.find('input');

expect(input.attr('md-no-asterisk')).toBe('true');
});

});

describe('md-highlight-text', function() {
Expand Down
2 changes: 2 additions & 0 deletions src/components/autocomplete/js/autocompleteDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ angular
* make suggestions
* @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking
* for results
* @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating label
* @param {boolean=} md-autofocus If true, will immediately focus the input element
* @param {boolean=} md-autoselect If true, the first item will be selected by default
* @param {string=} md-menu-class This will be applied to the dropdown menu for styling
Expand Down Expand Up @@ -236,6 +237,7 @@ function MdAutocomplete () {
ng-model="$mdAutocompleteCtrl.scope.searchText"\
ng-keydown="$mdAutocompleteCtrl.keydown($event)"\
ng-blur="$mdAutocompleteCtrl.blur()"\
' + (attr.mdNoAsterisk != null ? 'md-no-asterisk="' + attr.mdNoAsterisk + '"' : '') + '\
ng-focus="$mdAutocompleteCtrl.focus()"\
aria-owns="ul-{{$mdAutocompleteCtrl.id}}"\
aria-label="{{floatingLabel}}"\
Expand Down

0 comments on commit 65fa722

Please sign in to comment.