command-handler-tests.html 2.56 KB
Newer Older
Rafael Monnerat's avatar
Rafael Monnerat committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<!--
Copyright 2004 ThoughtWorks, Inc

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Test for the CommandHandler</title>
    <link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css">
<script language="JavaScript" type="text/javascript" src="../../jsunit/app/jsUnitCore.js"></script>
<script language="JavaScript" type="text/javascript" src="../jsmock/mock.js"></script>
<script language="JavaScript" type="text/javascript" src="../dummy-logging.js"></script>
<script language="JavaScript" type="text/javascript" src="../../core/lib/prototype.js"></script>
<script language="JavaScript" type="text/javascript" src="../../core/scripts/htmlutils.js"></script>
<script language="JavaScript" type="text/javascript" src="../../core/scripts/selenium-commandhandlers.js"></script>
<script language="JavaScript" type="text/javascript">

function testActionCommandsShouldCheckForUnhandledPopups() {

     var mockSelenium = new Mock();
     mockSelenium.expects("ensureNoUnhandledPopups");

     var noop = function() {};
     var handler = new ActionHandler(noop, false);
     handler.execute(mockSelenium, "command");

     mockSelenium.verify();
}


function testAccessorHandlerShouldReturnResultInCommandResult() {
        function MockSelenium() {
     }

        var executorCalled = false;
        var executor = function() { executorCalled = true; return "foo"; };
        var handler = new AccessorHandler(executor, false);

        result = handler.execute(new MockSelenium(), "command");

        assertTrue(executorCalled);
        assertEquals("foo", result.result);
}

</script>
  </head>

  <body>
    <h1>CommandHandler component tests</h1>

    <p>This page contains tests for different components in the CommandHandler. To see them, take a look at the source. To run them, load this file via JsUnit's testRunner.html</p>
  </body>
</html>