OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #library('FormElementTest'); |
| 6 |
| 7 #import('../../pkg/unittest/unittest.dart'); |
| 8 #import('../../pkg/unittest/html_config.dart'); |
| 9 #import('dart:html'); |
| 10 |
| 11 void main() { |
| 12 useHtmlConfiguration(); |
| 13 |
| 14 test('constructorTest1', () { |
| 15 var form = new FormElement(); |
| 16 expect(form, isNotNull); |
| 17 expect(form is FormElement); |
| 18 }); |
| 19 |
| 20 test('checkValidityTest', () { |
| 21 var form = new FormElement(); |
| 22 form.innerHTML = '<label>Google: <input type="search" name="q"></label> ' |
| 23 '<input type="submit" value="Search...">'; |
| 24 expect(form.checkValidity(), isTrue); |
| 25 form.innerHTML = '<input blaber="test" required>'; |
| 26 expect(form.checkValidity(), isFalse); |
| 27 }); |
| 28 |
| 29 var form = new FormElement(); |
| 30 test('acceptCharsetTest', () { |
| 31 var charset = 'abc'; |
| 32 form.acceptCharset = charset; |
| 33 expect(form.acceptCharset, charset); |
| 34 }); |
| 35 |
| 36 test('actionTest', () { |
| 37 var action = 'http://dartlang.org/'; |
| 38 form.action = action; |
| 39 expect(form.action, action); |
| 40 }); |
| 41 |
| 42 test('autocompleteTest', () { |
| 43 var auto = 'on'; |
| 44 form.autocomplete = auto; |
| 45 expect(form.autocomplete, auto); |
| 46 }); |
| 47 |
| 48 test('encodingAndEnctypeTest', () { |
| 49 expect(form.enctype, form.encoding); |
| 50 }); |
| 51 |
| 52 test('lengthTest', () { |
| 53 expect(form.length, 0); |
| 54 form.innerHTML = '<label>Google: <input type="search" name="q"></label> ' |
| 55 '<input type="submit" value="Search...">'; |
| 56 expect(form.length, 2); |
| 57 }); |
| 58 |
| 59 test('methodTest', () { |
| 60 var method = 'post'; |
| 61 form.method = method; |
| 62 expect(form.method, method); |
| 63 }); |
| 64 |
| 65 test('nameTest', () { |
| 66 var name = 'aname'; |
| 67 form.name = name; |
| 68 expect(form.name, name); |
| 69 }); |
| 70 |
| 71 test('noValidateTest', () { |
| 72 form.noValidate = true; |
| 73 expect(form.noValidate, true); |
| 74 }); |
| 75 |
| 76 test('targetTest', () { |
| 77 var target = 'target'; |
| 78 form.target = target; |
| 79 expect(form.target, target); |
| 80 }); |
| 81 } |
OLD | NEW |