Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: third_party/polymer/components/iron-form/test/basic.html

Issue 3010683002: Update Polymer components. (Closed)
Patch Set: Rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 @license 3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
8 Code distributed by Google as part of the polymer project is also 8 Code distributed by Google as part of the polymer project is also
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 --> 10 -->
(...skipping 23 matching lines...) Expand all
34 <input name="foo" value="bar"> 34 <input name="foo" value="bar">
35 </form> 35 </form>
36 </template> 36 </template>
37 </test-fixture> 37 </test-fixture>
38 38
39 <test-fixture id="Dupes"> 39 <test-fixture id="Dupes">
40 <template> 40 <template>
41 <form is="iron-form"> 41 <form is="iron-form">
42 <input name="foo" value="bar"> 42 <input name="foo" value="bar">
43 <input name="foo" value="barbar"> 43 <input name="foo" value="barbar">
44 <input name="empty" value="">
45 <input name="empty" value="">
44 <simple-element name="zig" value="zig"></simple-element> 46 <simple-element name="zig" value="zig"></simple-element>
45 <simple-element name="zig" value="zag"></simple-element> 47 <simple-element name="zig" value="zag"></simple-element>
46 <simple-element name="zig" value="zug"></simple-element> 48 <simple-element name="zig" value="zug"></simple-element>
47 </form> 49 </form>
48 </template> 50 </template>
49 </test-fixture> 51 </test-fixture>
50 52
51 <test-fixture id="NestedDupes"> 53 <test-fixture id="NestedDupes">
52 <template> 54 <template>
53 <form is="iron-form"> 55 <form is="iron-form">
(...skipping 27 matching lines...) Expand all
81 <test-fixture id="Disabled"> 83 <test-fixture id="Disabled">
82 <template> 84 <template>
83 <form is="iron-form"> 85 <form is="iron-form">
84 <input name="foo" value="bar1"> 86 <input name="foo" value="bar1">
85 <input name="foo" value="bar2" disabled> 87 <input name="foo" value="bar2" disabled>
86 <input type="checkbox" name="zig" value="zag" disabled checked> 88 <input type="checkbox" name="zig" value="zag" disabled checked>
87 </form> 89 </form>
88 </template> 90 </template>
89 </test-fixture> 91 </test-fixture>
90 92
93 <test-fixture id="FormUnsetMethod">
94 <template>
95 <form is="iron-form" action="/responds_with_json">
96 <simple-element name="zig" value="zag"></simple-element>
97 </form>
98 </template>
99 </test-fixture>
100
91 <test-fixture id="FormGet"> 101 <test-fixture id="FormGet">
92 <template> 102 <template>
93 <form is="iron-form" action="/responds_with_json" method="get"> 103 <form is="iron-form" action="/responds_with_json" method="get">
94 <simple-element name="zig" value="zag"></simple-element> 104 <simple-element name="zig" value="zag"></simple-element>
95 </form> 105 </form>
96 </template> 106 </template>
97 </test-fixture> 107 </test-fixture>
98 108
99 <test-fixture id="FormPost"> 109 <test-fixture id="FormPost">
100 <template> 110 <template>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 var json = f.serialize(); 370 var json = f.serialize();
361 assert.equal(Object.keys(json).length, 2); 371 assert.equal(Object.keys(json).length, 2);
362 assert.equal(json['zig'], 'zag'); 372 assert.equal(json['zig'], 'zag');
363 assert.equal(json['foo'], 'bar'); 373 assert.equal(json['foo'], 'bar');
364 }); 374 });
365 375
366 test('serializes elements with duplicate names', function() { 376 test('serializes elements with duplicate names', function() {
367 f = fixture('Dupes'); 377 f = fixture('Dupes');
368 378
369 assert.equal(f._customElements.length, 3); 379 assert.equal(f._customElements.length, 3);
370 assert.equal(f.elements.length, 2); 380 assert.equal(f.elements.length, 4);
371 381
372 var json = f.serialize(); 382 var json = f.serialize();
373 assert.equal(Object.keys(json).length, 2); 383 assert.equal(Object.keys(json).length, 3);
374 assert.equal(json['foo'].length, 2); 384 assert.equal(json['foo'].length, 2);
375 assert.equal(json['foo'][0], 'bar'); 385 assert.equal(json['foo'][0], 'bar');
376 assert.equal(json['foo'][1], 'barbar'); 386 assert.equal(json['foo'][1], 'barbar');
387 assert.equal(json['empty'].length, 2);
388 assert.equal(json['empty'][0], '');
389 assert.equal(json['empty'][1], '');
377 assert.equal(json['zig'].length, 3); 390 assert.equal(json['zig'].length, 3);
378 assert.equal(json['zig'][0], 'zig'); 391 assert.equal(json['zig'][0], 'zig');
379 assert.equal(json['zig'][1], 'zag'); 392 assert.equal(json['zig'][1], 'zag');
380 assert.equal(json['zig'][2], 'zug'); 393 assert.equal(json['zig'][2], 'zug');
381 }); 394 });
382 395
383 test('serializes elements with checked states', function() { 396 test('serializes elements with checked states', function() {
384 f = fixture('CheckedStates'); 397 f = fixture('CheckedStates');
385 398
386 assert.equal(f._customElements.length, 0); 399 assert.equal(f._customElements.length, 0);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 form.addEventListener('custom-form-submit', function(event) { 740 form.addEventListener('custom-form-submit', function(event) {
728 expect(presubmitted).to.be.equal(true); 741 expect(presubmitted).to.be.equal(true);
729 expect(formResponseHandler.callCount).to.be.equal(0); 742 expect(formResponseHandler.callCount).to.be.equal(0);
730 expect(formSubmitHandler.callCount).to.be.equal(0); 743 expect(formSubmitHandler.callCount).to.be.equal(0);
731 done(); 744 done();
732 }); 745 });
733 746
734 form.submit(); 747 form.submit();
735 }); 748 });
736 749
750 test('can submit with method unset, defaults to method=get', function(done) {
751 form = fixture('FormUnsetMethod');
752
753 var submitted = false;
754 form.addEventListener('iron-form-submit', function() {
755 submitted = true;
756 });
757
758 form.addEventListener('iron-form-response', function(event) {
759 expect(this.request.method).to.be.equal('GET');
760 expect(submitted).to.be.equal(true);
761 expect(event.detail.url).to.contain('zig=zag');
762
763 var response = event.detail.response;
764 expect(response).to.be.ok;
765 expect(response).to.be.an('object');
766 expect(response.success).to.be.equal(true);
767 done();
768 });
769
770 form.submit();
771 server.respond();
772 });
773
737 test('can submit with method=get', function(done) { 774 test('can submit with method=get', function(done) {
738 form = fixture('FormGet'); 775 form = fixture('FormGet');
739 776
740 var submitted = false; 777 var submitted = false;
741 form.addEventListener('iron-form-submit', function() { 778 form.addEventListener('iron-form-submit', function() {
742 submitted = true; 779 submitted = true;
743 }); 780 });
744 781
745 form.addEventListener('iron-form-response', function(event) { 782 form.addEventListener('iron-form-response', function(event) {
746 expect(submitted).to.be.equal(true); 783 expect(submitted).to.be.equal(true);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 form.submit(); 832 form.submit();
796 server.respond(); 833 server.respond();
797 }); 834 });
798 835
799 }); 836 });
800 837
801 </script> 838 </script>
802 839
803 </body> 840 </body>
804 </html> 841 </html>
OLDNEW
« no previous file with comments | « third_party/polymer/components/iron-form/iron-form.html ('k') | third_party/polymer/components/iron-icon/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698