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

Unified Diff: runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.dart

Issue 2159273003: Converted Observatory top-nav-menu element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Splitted instructions in multiple lines Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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;
});
« no previous file with comments | « runtime/observatory/observatory_sources.gypi ('k') | runtime/observatory/tests/observatory_ui/nav/top-menu/element_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698