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

Bugfix/263 reset for dom if #264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iron-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@
_init: function() {
this._form.addEventListener('submit', this.submit.bind(this));
this._form.addEventListener('reset', this.reset.bind(this));
this.addEventListener("dom-change", this._saveInitialValues.bind(this));

// Save the initial values.
this._defaults = this._defaults || new WeakMap();
Expand Down
24 changes: 19 additions & 5 deletions test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@
<template id="repeat" is="dom-repeat" >
<paper-input name="paper_[[index]]" id="paper_[[index]]" value="input"></paper-input>
</template>
<template id="if" is="dom-if" >>
<paper-input value="dynamic field" id="dynamic_if"> </paper-input>
</template>
</form>
</iron-form>
</template>
Expand All @@ -255,6 +258,12 @@
<paper-input name="paper_[[index]]" id="paper_[[index]]" value="input"></paper-input>
</template>
</dom-repeat>

<dom-if id="if" >
<template>
<paper-input value="dynamic field" id="dynamic_if"> </paper-input>
</template>
</dom-if>
</form>
</iron-form>
</template>
Expand Down Expand Up @@ -907,15 +916,20 @@
}

document.getElementById('repeat').items = ['item'];

Polymer.Base.async(function() {

document.getElementById('paper_0').value = 'input1++';
document.getElementById('if').if = true;

form.reset();

expect(document.getElementById('paper_0').value).to.be.equal('input');
done();
Polymer.Base.async(function() {
document.getElementById('dynamic_if').value = 'input1++';
form.reset();

expect(document.getElementById('paper_0').value).to.be.equal('input');
expect(document.getElementById('dynamic_if').value).to.be.equal('dynamic field');
done();
}, 0);
}, 1);
});

Expand Down