<commit_before>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library polymer.test.web.event_path_test;

import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';

@CustomTag("x-selector")
class XSelector extends PolymerElement {
  XSelector.created() : super.created();
}

@CustomTag("x-overlay")
class XOverlay extends PolymerElement {
  XOverlay.created() : super.created();
}

@CustomTag("x-menu")
class XMenu extends PolymerElement {
  XMenu.created() : super.created();
}

@CustomTag("x-menu-button")
class XMenuButton extends PolymerElement {
  XMenuButton.created() : super.created();
}

main() {
  initPolymer();
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('bubbling in the right order', () {
    var item1 = querySelector('#item1');
    var menuButton = querySelector('#menuButton');
    // Note: polymer uses automatic node finding (menuButton.$.menu)
    // also note that their node finding code also reachs into the ids
    // from the parent shadow (menu.$.selectorContent instead of
    // menu.$.menuShadow.$.selectorContent)
    var menu = menuButton.shadowRoot.querySelector('#menu');
    var overlay = menuButton.shadowRoot.querySelector('#overlay');
    var expectedPath = <Node>[
        item1,
        menuButton.shadowRoot.querySelector('#menuButtonContent'),
        menu.shadowRoot.olderShadowRoot.querySelector('#selectorContent'),
        menu.shadowRoot.olderShadowRoot.querySelector('#selectorDiv'),
        menu.shadowRoot.olderShadowRoot,
        menu.shadowRoot.querySelector('#menuShadow'),
        menu.shadowRoot.querySelector('#menuDiv'),
        menu.shadowRoot,
        menu,
        menuButton.shadowRoot.querySelector('#menuButtonDiv'),
        // TODO(sigmund): this test is currently broken because currently<commit_msg>Reenable event path test<commit_after>// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library polymer.test.web.event_path_test;

import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';

class XSelector extends PolymerElement {
  XSelector.created() : super.created();
}

class XOverlay extends PolymerElement {
  XOverlay.created() : super.created();
}

class XMenu extends PolymerElement {
  XMenu.created() : super.created();
}

class XMenuButton extends PolymerElement {
  XMenuButton.created() : super.created();
}

main() {
  // TODO(sigmund): use @CustomTag instead of Polymer.regsiter. A bug is making
  // this code sensitive to the order in which we register elements (e.g. if
  // x-menu is registered before x-selector). See dartbug.com/17926.
  Polymer.register('x-selector', XSelector);
  Polymer.register('x-overlay', XOverlay);
  Polymer.register('x-menu', XMenu);
  Polymer.register('x-menu-button', XMenuButton);

  initPolymer();
  useHtmlConfiguration();

  setUp(() => Polymer.onReady);

  test('bubbling in the right order', () {
    var item1 = querySelector('#item1');
    var menuButton = querySelector('#menuButton');
    // Note: polymer uses automatic node finding (menuButton.$.menu)
    // also note that their node finding code also reachs into the ids
    // from the parent shadow (menu.$.selectorContent instead of
    // menu.$.menuShadow.$.selectorContent)
    var menu = menuButton.shadowRoot.querySelector('#menu');
    var overlay = menuButton.shadowRoot.querySelector('#overlay');
    var expectedPath = <Node>[
        item1,
        menuButton.shadowRoot.querySelector('#menuButtonContent'),
        menu.shadowRoot.olderShadowRoot.querySelector('#selectorContent'),
        menu.shadowRoot.olderShadowRoot.querySelector('#selectorDiv'),
        menu.shadowRoot.olderShadowRoot,
        menu.shadowRoot.querySelector('#menuShadow'),
        menu.shadowRoot.querySelector('#menuDiv'),
        menu.shadowRoot,
        menu,
        menuButton.shadowRoot.querySelector('#menuButtonDiv'),
        // TODO(sigmund): this test is currently broken because currently
{'fraction_non_alphanumeric': 0.1227551716299159, 'fraction_numerical': 0.004319163446237781, 'mean_word_length': 4.080831408775982, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4521915', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1212, 'n_words': 326}