Index: runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.dart |
diff --git a/runtime/observatory/tests/observatory_ui/nav/menu/element_test.dart b/runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.dart |
similarity index 52% |
copy from runtime/observatory/tests/observatory_ui/nav/menu/element_test.dart |
copy to runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.dart |
index 0cabc3cfabd9b09e8b3578854537de3e97cb9b7c..df9f88c938fc0b8074133c9ed8c3e929751dd807 100644 |
--- a/runtime/observatory/tests/observatory_ui/nav/menu/element_test.dart |
+++ b/runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.dart |
@@ -4,32 +4,32 @@ |
import 'dart:html'; |
import 'package:unittest/unittest.dart'; |
import 'package:observatory/src/elements/nav/menu.dart'; |
+import 'package:observatory/src/elements/nav/top_menu.dart'; |
main() { |
- NavMenuElement.tag.ensureRegistration(); |
+ NavTopMenuElement.tag.ensureRegistration(); |
+ |
+ final String tag = NavMenuElement.tag.name; |
group('instantiation', () { |
- final label = 'custom-label'; |
- test('label', () { |
- final NavMenuElement e = new NavMenuElement(label); |
+ test('default', () { |
+ final NavTopMenuElement e = new NavTopMenuElement(); |
expect(e, isNotNull, reason: 'element correctly created'); |
- expect(e.label, equals(label), reason: 'element correctly created'); |
}); |
test('not last', () { |
- final NavMenuElement e = new NavMenuElement(label, last: false); |
+ final NavTopMenuElement e = new NavTopMenuElement(last: false); |
expect(e, isNotNull, reason: 'element correctly created'); |
expect(e.last, isFalse, reason: 'element correctly created'); |
}); |
test('last', () { |
- final NavMenuElement e = new NavMenuElement(label, last: true); |
+ final NavTopMenuElement e = new NavTopMenuElement(last: true); |
expect(e, isNotNull, reason: 'element correctly created'); |
expect(e.last, isTrue, reason: 'element correctly created'); |
}); |
}); |
group('elements', () { |
test('created', () async { |
- final label = 'custom-label'; |
- final NavMenuElement e = new NavMenuElement(label); |
+ final NavTopMenuElement e = new NavTopMenuElement(); |
document.body.append(e); |
await e.onRendered.first; |
expect(e.shadowRoot.children.length, isNonZero, reason: 'has elements'); |
@@ -39,33 +39,17 @@ main() { |
await e.onRendered.first; |
expect(e.shadowRoot.children.length, isZero, reason: 'is empty'); |
}); |
- test('react to label change', () async { |
- final label1 = 'custom-label-1'; |
- final label2 = 'custom-label-2'; |
- final NavMenuElement e = new NavMenuElement(label1); |
- document.body.append(e); |
- await e.onRendered.first; |
- expect(e.shadowRoot.innerHtml.contains(label1), isTrue); |
- expect(e.shadowRoot.innerHtml.contains(label2), isFalse); |
- e.label = label2; |
- await e.onRendered.first; |
- expect(e.shadowRoot.innerHtml.contains(label1), isFalse); |
- expect(e.shadowRoot.innerHtml.contains(label2), isTrue); |
- e.remove(); |
- await e.onRendered.first; |
- }); |
test('react to last change', () async { |
- final label = 'custom-label'; |
- final NavMenuElement e = new NavMenuElement(label, last: false); |
+ final NavTopMenuElement e = new NavTopMenuElement(last: false); |
document.body.append(e); |
await e.onRendered.first; |
- expect(e.shadowRoot.innerHtml.contains('>'), isTrue); |
+ expect((e.shadowRoot.querySelector(tag) as NavMenuElement).last, isFalse); |
e.last = true; |
await e.onRendered.first; |
- expect(e.shadowRoot.innerHtml.contains('>'), isFalse); |
+ expect((e.shadowRoot.querySelector(tag) as NavMenuElement).last, isTrue); |
e.last = false; |
await e.onRendered.first; |
- expect(e.shadowRoot.innerHtml.contains('>'), isTrue); |
+ expect((e.shadowRoot.querySelector(tag) as NavMenuElement).last, isFalse); |
e.remove(); |
await e.onRendered.first; |
}); |