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
Closes #7119
  • Loading branch information
devversion authored and ThomasBurleson committed Mar 30, 2016
1 parent 6d705b9 commit 5e043a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/autocomplete/autocomplete.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,25 @@ describe('<md-autocomplete>', function() {
expect(ctrl.isRequired).toBe(true);
});

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 @@ -52,6 +52,7 @@ angular
* @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a `$mdDialog`,
* `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. <br/><br/>
* Also the autocomplete will immediately focus the input element.
* @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating label
* @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
* @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in
Expand Down Expand Up @@ -244,6 +245,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}}"\
' + (attr.mdSelectOnFocus != null ? 'md-select-on-focus=""' : '') + '\
Expand Down

0 comments on commit 5e043a1

Please sign in to comment.