Exemplo n.º 1
0
 void IEventTarget.AddEventListener(
     string type,
     EventListener listener,
     bool useCapture)
 {
     eventTarget.AddEventListener(type, listener, useCapture);
 }
Exemplo n.º 2
0
        public void SetUp()
        {
            _handlers = new Mock <IEventHandlers>();

            _rootOriginal = new object();
            _root         = new EventTarget(_rootOriginal, () => null);
            _root.AddEventListener("click", _handlers.Object.OnRootBubble, false);
            _root.AddEventListener("click", _handlers.Object.OnRootCapture, true);

            _parentOriginal = new object();
            _parent         = new EventTarget(_parentOriginal, () => _root);
            _parent.AddEventListener("click", _handlers.Object.OnParentBubble, false);

            _childOriginal = new object();
            _child         = new EventTarget(_childOriginal, () => _parent);
            _child.AddEventListener("click", _handlers.Object.OnChildBubble, false);
        }
Exemplo n.º 3
0
        public void CreateEventTest()
        {
            var @event      = new Event <IBuildEvent>();
            var assertEvent = default(Event <IBuildEvent>);
            var count       = 0;

            EventTarget.AddEventListener <IBuildEvent>(e =>
            {
                assertEvent = e;
                count++;
            });
            EventTarget.AddEventListener <IBuildEvent>(e =>
            {
                assertEvent = e;
                count++;
            });

            EventTarget.DispatchEvent(@event);

            assertEvent.Should().NotBeNull();
            assertEvent.Type.Should().Be <IBuildEvent>();

            count.Should().BeGreaterOrEqualTo(2);
        }