예제 #1
0
        public void Should_create_javascript_code_to_call_click_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock());

            // WHEN
            var command = creator.CreateEvent("click", new NameValueCollection{},true );

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"MouseEvents\");event.initMouseEvent('click',true,true,null,0,0,0,0,0,false,false,false,false,0,null);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #2
0
        public void Should_create_javascript_code_to_call_key_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("onkeydown", new NameValueCollection {
            }, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"KeyboardEvent\");event.initKeyEvent('keydown',true,true,null,false,false,false,false,0,0);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #3
0
        public void Should_create_javascript_code_to_call_click_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock());

            // WHEN
            var command = creator.CreateEvent("click", new NameValueCollection {
            }, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"MouseEvents\");event.initMouseEvent('click',true,true,null,0,0,0,0,0,false,false,false,false,0,null);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #4
0
        public void Should_create_javascript_code_to_call_any_non_key_mouse_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("focus", new NameValueCollection {
            }, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Console.WriteLine(command);
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"HTMLEvents\");event.initEvent('focus',true,true);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #5
0
        public void Should_create_javascript_code_to_call_any_non_key_mouse_event_with_params_set()
        {
            // GIVEN
            var eventParams = new NameValueCollection
            {
                { "notused", "notused" },
                { "bubbles", "bubbles" },
                { "cancelable", "cancelable" },
            };

            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("focus", eventParams, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"HTMLEvents\");event.initEvent('focus',bubbles,cancelable);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #6
0
        public void Should_create_javascript_code_to_call_any_non_key_mouse_event_with_params_set()
        {
            // GIVEN
            var eventParams = new NameValueCollection
                {
                    {"notused", "notused"},
                    {"bubbles", "bubbles"},
                    {"cancelable", "cancelable"},
                };

            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("focus", eventParams, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"HTMLEvents\");event.initEvent('focus',bubbles,cancelable);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #7
0
        public void Should_create_javascript_code_to_call_key_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("onkeydown", new NameValueCollection { }, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"KeyboardEvent\");event.initKeyEvent('keydown',true,true,null,false,false,false,false,0,0);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }
예제 #8
0
        public void Should_create_javascript_code_to_call_any_non_key_mouse_event_with_the_defaults()
        {
            // GIVEN
            var creator = new JSEventCreator("test", new ClientPortMock(JavaScriptEngineType.Mozilla));

            // WHEN
            var command = creator.CreateEvent("focus", new NameValueCollection { }, true);

            // THEN
            Assert.That(command, Is.Not.Null, "Expected code");
            Console.WriteLine(command);
            Assert.That(command, Is.EqualTo("var event = test.ownerDocument.createEvent(\"HTMLEvents\");event.initEvent('focus',true,true);var res = test.dispatchEvent(event); if(res){true;}else{false;};"), "Unexpected method signature");
        }