Debian Codegraph @

dojox/mobile/tests/doh/TestHelper.js

raw symbols SCIP
1 define([
2 "dojo/_base/declare",
3 "dojo/_base/lang",
4 "dojo/sniff",
5 "dojo/dom-class",
6 "dijit/registry",
7 "doh/runner"
8 ], function(declare, lang, has, domClass, registry, runner){
9
10 // module:
11 // dojox/mobile/tests/doh/TestHelper
12 // summary:
13 // A DOH test Helper class
14
15 var TestHelper = new function(){
16
17 this.fireOnClick = function(obj){
18 var node;
19 if(typeof obj === "string"){
20 var widget = registry.byId(obj);
21 node = widget.domNode;
22 }else{
23 node = obj;
24 }
25 if (has("ie") === 10 || (!has("ie") && has("trident") > 6)){
26 this.fireOnEvent(node, "MSPointerDown");
27 this.fireOnEvent(node, "MSPointerUp");
28 }else{
29 this.fireOnEvent(node, "mousedown");
30 this.fireOnEvent(node, "mouseup");
31 }
32 };
33
34 this.fireOnEvent = function(node, evstr){
35 if(has("ie")<9){
36 node.fireEvent( "on" + evstr );
37 }else{
38 var e = document.createEvent('Events');
39 e.initEvent(evstr, true, true);
40 node.dispatchEvent(e);
41 }
42 };
43 this.verifyImageSrc = function(node, regExp, hintPrefix, hintSuffix) {
44 hintPrefix = hintPrefix || "";
45 hintSuffix = hintSuffix || "";
46 if(!has("ie") && regExp && node){
47 doh.assertTrue(node.src.search(regExp) != -1, hintPrefix + "search " + regExp.toString() + hintSuffix);
48 }
49 };
50 };
51 return TestHelper;
52 });