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

Commit

Permalink
Merge pull request #116 from PolymerElements/fix-114
Browse files Browse the repository at this point in the history
Only care about registered form parents if they're actually submittable
  • Loading branch information
notwaldorf committed Feb 29, 2016
2 parents d3f6c08 + 4c682e1 commit c118a10
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions iron-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@
// Use logical parentnode, or native ShadowRoot host.
parent = Polymer.dom(parent).parentNode || parent.host;

// Check if the parent was registered.
if (parent && parent._parentForm === this) {
// Check if the parent was registered and submittable.
if (parent && parent.name && parent._parentForm === this) {
return true;
}
}
Expand Down
21 changes: 20 additions & 1 deletion test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
</template>
</test-fixture>

<test-fixture id="NestedSubmittable">
<template>
<form is="iron-form">
<element-with-nested-form-element>
<simple-element name="foo" value="bar"></simple-element>
</element-with-nested-form-element>
</form>
</template>
</test-fixture>

<test-fixture id="CheckedStates">
<template>
<form is="iron-form">
Expand Down Expand Up @@ -333,13 +343,22 @@
f = fixture('NestedDupes');

assert.equal(f._customElements.length, 3);

var json = f.serialize();
assert.equal(Object.keys(json).length, 2);
assert.equal(json['foo'], 'bar');
assert.equal(json['zig'], 'zag');
});


test('nested elements can be submitted if parents aren\'t submittable', function() {
f = fixture('NestedSubmittable');

var json = f.serialize();
assert.equal(Object.keys(json).length, 1);
assert.equal(json['foo'], 'bar');
});

});

suite('resetting', function () {
Expand Down
1 change: 1 addition & 0 deletions test/element-with-nested-form-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<dom-module id="element-with-nested-form-element">
<template>
<simple-element name$="[[name]]"></simple-element>
<content></content>
</template>
</dom-module>

Expand Down

0 comments on commit c118a10

Please sign in to comment.