| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('ElementTest'); | 5 #library('ElementTest'); |
| 6 #import('../../pkg/unittest/unittest.dart'); | 6 #import('../../pkg/unittest/unittest.dart'); |
| 7 #import('../../pkg/unittest/html_config.dart'); | 7 #import('../../pkg/unittest/html_config.dart'); |
| 8 #import('dart:html'); | 8 #import('dart:html'); |
| 9 | 9 |
| 10 expectLargeRect(ClientRect rect) { | 10 expectLargeRect(ClientRect rect) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 test('area', () => testConstructorHelper('area', '<area>foo</area>', '', | 96 test('area', () => testConstructorHelper('area', '<area>foo</area>', '', |
| 97 (element) => element is AreaElement)); | 97 (element) => element is AreaElement)); |
| 98 // TODO(jacobr): audio tags cause tests to segfault when using dartium. | 98 // TODO(jacobr): audio tags cause tests to segfault when using dartium. |
| 99 // b/5522106. | 99 // b/5522106. |
| 100 // test('audio', () => testConstructorHelper('audio', | 100 // test('audio', () => testConstructorHelper('audio', |
| 101 // '<audio>foo</audio>', 'foo', | 101 // '<audio>foo</audio>', 'foo', |
| 102 // (element) => element is AudioElement)); | 102 // (element) => element is AudioElement)); |
| 103 test('br', () => testConstructorHelper('br', '<br>', '', | 103 test('br', () => testConstructorHelper('br', '<br>', '', |
| 104 (element) => element is BRElement)); | 104 (element) => element is BRElement)); |
| 105 test('base', () => testConstructorHelper('base', '<base>foo</base>', '', | 105 test('base', () => testConstructorHelper('base', '<base>foo</base>', '', |
| 106 (element) => element is BaseElement)); | 106 (element) => element is BaseElement)); |
| 107 test('blockquote', () => testConstructorHelper('blockquote', | 107 test('blockquote', () => testConstructorHelper('blockquote', |
| 108 '<blockquote>foo</blockquote>', 'foo', | 108 '<blockquote>foo</blockquote>', 'foo', |
| 109 (element) => element is QuoteElement)); | 109 (element) => element is QuoteElement)); |
| 110 test('body', () => testConstructorHelper('body', | 110 test('body', () => testConstructorHelper('body', |
| 111 '<body><div>foo</div></body>', 'foo', | 111 '<body><div>foo</div></body>', 'foo', |
| 112 (element) => element is BodyElement)); | 112 (element) => element is BodyElement)); |
| 113 test('button', () => testConstructorHelper('button', | 113 test('button', () => testConstructorHelper('button', |
| 114 '<button>foo</button>', 'foo', | 114 '<button>foo</button>', 'foo', |
| 115 (element) => element is ButtonElement)); | 115 (element) => element is ButtonElement)); |
| 116 test('canvas', () => testConstructorHelper('canvas', | 116 test('canvas', () => testConstructorHelper('canvas', |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 (listener) => Testing.addEventListener( | 409 (listener) => Testing.addEventListener( |
| 410 element, 'touchmove', listener, true)); | 410 element, 'touchmove', listener, true)); |
| 411 testEventHelper(on.touchStart, 'touchstart', | 411 testEventHelper(on.touchStart, 'touchstart', |
| 412 (listener) => Testing.addEventListener( | 412 (listener) => Testing.addEventListener( |
| 413 element, 'touchstart', listener, true)); | 413 element, 'touchstart', listener, true)); |
| 414 testEventHelper(on.transitionEnd, 'webkitTransitionEnd'); | 414 testEventHelper(on.transitionEnd, 'webkitTransitionEnd'); |
| 415 testEventHelper(on.fullscreenChange, 'webkitfullscreenchange', | 415 testEventHelper(on.fullscreenChange, 'webkitfullscreenchange', |
| 416 (listener) => Testing.addEventListener(element, | 416 (listener) => Testing.addEventListener(element, |
| 417 'webkitfullscreenchange', listener, true)); | 417 'webkitfullscreenchange', listener, true)); |
| 418 }); | 418 }); |
| 419 | 419 |
| 420 group('attributes', () { | 420 group('attributes', () { |
| 421 test('manipulation', () { | 421 test('manipulation', () { |
| 422 final element = new Element.html( | 422 final element = new Element.html( |
| 423 '''<div class="foo" style="overflow: hidden" data-foo="bar" | 423 '''<div class="foo" style="overflow: hidden" data-foo="bar" |
| 424 data-foo2="bar2" dir="rtl"> | 424 data-foo2="bar2" dir="rtl"> |
| 425 </div>'''); | 425 </div>'''); |
| 426 final attributes = element.attributes; | 426 final attributes = element.attributes; |
| 427 Expect.equals(attributes['class'], 'foo'); | 427 Expect.equals(attributes['class'], 'foo'); |
| 428 Expect.equals(attributes['style'], 'overflow: hidden'); | 428 Expect.equals(attributes['style'], 'overflow: hidden'); |
| 429 Expect.equals(attributes['data-foo'], 'bar'); | 429 Expect.equals(attributes['data-foo'], 'bar'); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 }); | 743 }); |
| 744 | 744 |
| 745 test('getRange', () { | 745 test('getRange', () { |
| 746 var range = makeElList().getRange(1, 2); | 746 var range = makeElList().getRange(1, 2); |
| 747 Expect.isTrue(range is ElementList); | 747 Expect.isTrue(range is ElementList); |
| 748 Expect.isTrue(range[0] is ImageElement); | 748 Expect.isTrue(range[0] is ImageElement); |
| 749 Expect.isTrue(range[1] is InputElement); | 749 Expect.isTrue(range[1] is InputElement); |
| 750 }); | 750 }); |
| 751 }); | 751 }); |
| 752 } | 752 } |
| OLD | NEW |