| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>TabContainer BIDI DOH Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../themes/claro/document.css"; |
| 9 |
@import "../../css/dijitTests.css"; |
| 10 |
</style> |
| 11 |
|
| 12 |
|
| 13 |
<link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/> |
| 14 |
|
| 15 |
|
| 16 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 17 |
data-dojo-config="async: true,isDebug: true, has: { 'dojo-bidi': true }"></script> |
| 18 |
|
| 19 |
<script type="text/javascript"> |
| 20 |
require([ |
| 21 |
"doh/runner", |
| 22 |
"dojo/dom", |
| 23 |
"dojo/parser", |
| 24 |
"dojo/query", |
| 25 |
"dijit/registry", |
| 26 |
"dijit/layout/TabContainer", |
| 27 |
"dijit/layout/ContentPane", |
| 28 |
"dojo/domReady!" |
| 29 |
], function(doh, dom, parser, query, registry, TabContainer, ContentPane){ |
| 30 |
|
| 31 |
doh.register("parse", function(){ |
| 32 |
return parser.parse(); |
| 33 |
}); |
| 34 |
|
| 35 |
doh.register("tests._BidiSupport.layout.TabContainer.Bidi", [ |
| 36 |
{ |
| 37 |
name: 'changing Tabs', |
| 38 |
runTest: function(){ |
| 39 |
var tc = registry.byId("tc1"); |
| 40 |
var cp = new ContentPane({ |
| 41 |
id: "newTab1", |
| 42 |
title: "Added Panel,RTL textDir !", |
| 43 |
content: "Added content pane with RTL textDir", |
| 44 |
textDir: "rtl" |
| 45 |
}); |
| 46 |
tc.addChild(cp); |
| 47 |
|
| 48 |
var t1 = registry.byId('t1'); |
| 49 |
t1.set('title', 'LTR panel,changed title!'); |
| 50 |
|
| 51 |
var tc1 = registry.byId("tc1"); |
| 52 |
children = tc1.getChildren(); |
| 53 |
children[1].set({ |
| 54 |
title: "Panel with no direction,changed title!" |
| 55 |
}); |
| 56 |
|
| 57 |
doh.is('ltr', query("#tc1_tablist_t1")[0].dir, "Pane have explicit LTR text direction"); |
| 58 |
doh.is('rtl', query("#tc1_tablist_t2")[0].dir, "Pane inherits RTL text direction from container"); |
| 59 |
doh.is('ltr', query("#tc1_tablist_t3")[0].dir, "Pane have explicit LTR text direction"); |
| 60 |
doh.is('rtl', query("#tc1_tablist_t4")[0].dir, "Pane inherits RTL text direction from container"); |
| 61 |
doh.is('rtl', query("#tc1_tablist_newTab1")[0].dir, "Added pane have explicit 'Auto' text direction"); |
| 62 |
doh.is('rtl', query("#tc3_tablist_three")[0].dir, "Pane have explicit RTL text direction"); |
| 63 |
doh.is('rtl', query("#tc3_tablist_four")[0].dir, "Pane have explicit RTL text direction"); |
| 64 |
} |
| 65 |
} |
| 66 |
]); |
| 67 |
|
| 68 |
doh.register("testingMenu", { |
| 69 |
name: "Test menu", |
| 70 |
runTest: function(){ |
| 71 |
var menuBtn = registry.byId("tc1_tablist_menuBtn"); |
| 72 |
menuBtn.toggleDropDown(); |
| 73 |
var menu = registry.byId("tc1_menu"); |
| 74 |
doh.is('ltr', menu.getChildren()[0].textDirNode.dir, "Menu item should have LTR text direction"); |
| 75 |
doh.is('rtl', menu.getChildren()[1].textDirNode.dir, "Menu item should have RTL text direction 1"); |
| 76 |
doh.is('ltr', menu.getChildren()[2].textDirNode.dir, "Menu item should have LTR text direction 2"); |
| 77 |
doh.is('rtl', menu.getChildren()[3].textDirNode.dir, "Menu item should have RTL text direction 3"); |
| 78 |
|
| 79 |
menuBtn.closeDropDown(); |
| 80 |
} |
| 81 |
}); |
| 82 |
|
| 83 |
doh.register("log", function(){ |
| 84 |
dom.byId('failures').innerHTML = doh._failureCount; |
| 85 |
dom.byId('errors').innerHTML = doh._errorCount; |
| 86 |
}); |
| 87 |
|
| 88 |
doh.run(); |
| 89 |
}); |
| 90 |
</script> |
| 91 |
|
| 92 |
</head> |
| 93 |
<body class="claro"> |
| 94 |
|
| 95 |
<h1 class="testTitle">Bidi TabContainer tests</h1> |
| 96 |
<h2 class="testTitle">TabContainer with RTL text direction and changed tabs</h2> |
| 97 |
<div id="tc1" data-dojo-type="dijit/layout/TabContainer" data-dojo-props='textDir: "rtl", style:"width: 550px; height: 60px;" '> |
| 98 |
<div id="t1" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='textDir: "ltr", title:"tab1 @", selected:true'> |
| 99 |
Title of this LTR pane has been changed |
| 100 |
</div> |
| 101 |
<div id="t2" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"tab2 @", closable:true'> |
| 102 |
Title of this pane with no text direction specified (inherited) has been changed |
| 103 |
</div> |
| 104 |
<div id="t3" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='textDir: "ltr", title:"Explicit LTR!", closable:true'> |
| 105 |
Explicit LTR text direction of content pane |
| 106 |
</div> |
| 107 |
<div id="t4" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"Inherited RTL!", closable:true'> |
| 108 |
Inherited RTL text direction of content pane tab |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
<br /> |
| 112 |
<h2 class="testTitle">TabContainer with RTL text direction</h2> |
| 113 |
<div id="tc3" data-dojo-type="dijit/layout/TabContainer" textDir="rtl" data-dojo-id="tc3" style="width: 300px; height:100px;"> |
| 114 |
<div data-dojo-type="dijit/layout/ContentPane" title="Explicit LTR!" textDir="ltr" data-dojo-id="one" id="one">Explicit LTR text direction of content pane</div> |
| 115 |
<div data-dojo-type="dijit/layout/ContentPane" title="Inherited RTL!" data-dojo-id="two" id="two">Inherited RTL text direction of content pane tab</div> |
| 116 |
<div data-dojo-type="dijit/layout/ContentPane" title="×Explicit AUTO!" data-dojo-id="three" id="three">Explicit 'auto' text direction of content pane</div> |
| 117 |
<div data-dojo-type="dijit/layout/ContentPane" title="Explicit RTL!" textDir="rtl" data-dojo-id="four" id="four">Explicit RTL text direction of content pane</div> |
| 118 |
</div> |
| 119 |
<br>Errors: <span id="errors">?</span> |
| 120 |
<br>Failures: <span id="failures">?</span> |
| 121 |
</body> |
| 122 |
</html> |