diff --git a/addon/components/materialize-input.js b/addon/components/materialize-input.js index 15b6b5e6..73e581be 100644 --- a/addon/components/materialize-input.js +++ b/addon/components/materialize-input.js @@ -4,6 +4,7 @@ import layout from '../templates/components/materialize-input'; export default MaterializeInputField.extend({ layout: layout, + type: 'text', didInsertElement: function() { this._super(); // make sure the label moves when a value is bound. @@ -13,4 +14,3 @@ export default MaterializeInputField.extend({ } } }); - diff --git a/addon/templates/components/materialize-input.hbs b/addon/templates/components/materialize-input.hbs index 9e5717a9..fd5efc82 100644 --- a/addon/templates/components/materialize-input.hbs +++ b/addon/templates/components/materialize-input.hbs @@ -1,11 +1,10 @@ {{#if icon}} {{/if}} -{{input id=id value=value classNameBindings="validate:validate: errors.firstObject:invalid:valid" type="text" +{{input id=id value=value classNameBindings="validate:validate: errors.firstObject:invalid:valid" type=type required=required pattern=pattern maxlength=maxlength readonly=readonly disabled=disabled autocomplete=autocomplete}} {{#if errors}} {{errors.firstObject}} {{else}}   {{/if}} - diff --git a/tests/dummy/app/templates/input.hbs b/tests/dummy/app/templates/input.hbs index b6787b63..3ea56ba7 100644 --- a/tests/dummy/app/templates/input.hbs +++ b/tests/dummy/app/templates/input.hbs @@ -19,6 +19,7 @@
  • label, default value null
  • icon, default value null
  • value, default value null
  • +
  • type, default value text
  • required, default value false
  • readonly, default value false
  • disabled, default value false
  • @@ -56,6 +57,20 @@ +
    +

    Input with type="password"

    +
    +
    + {{materialize-input value="test" label='Password' type="password"}} + +
    +
    +    {{materialize-input value="test" label="Password" type="password"}}
    +
    +      
    +
    +
    +

    Validations

    @@ -177,4 +192,3 @@ nameDidChange: function() {
    - diff --git a/tests/unit/components/materialize-input-test.js b/tests/unit/components/materialize-input-test.js index 1ce2d65d..7c2b8cfa 100644 --- a/tests/unit/components/materialize-input-test.js +++ b/tests/unit/components/materialize-input-test.js @@ -51,3 +51,10 @@ test('has an icon', function(assert) { this.render(); assert.ok(component.$('>i').hasClass(icon)); }); + +test('has type password', function(assert) { + var type = 'password'; + var component = this.subject({ type: type }); + this.render(); + assert.equal(component.$('>input').attr('type'), type); +});