| | 320 | function test_01_Map_defaultTheme(t) { |
|---|
| | 321 | t.plan(5); |
|---|
| | 322 | |
|---|
| | 323 | var head = document.getElementsByTagName('head')[0]; |
|---|
| | 324 | var nodeCount = head.childNodes.length; |
|---|
| | 325 | |
|---|
| | 326 | map = new OpenLayers.Map('map'); |
|---|
| | 327 | var lastNode = head.childNodes[head.childNodes.length - 1]; |
|---|
| | 328 | |
|---|
| | 329 | t.eq(nodeCount + 1, head.childNodes.length, "by default, a node is added to document head" ); |
|---|
| | 330 | t.eq(lastNode.tagName, "LINK", "node added is a link element"); |
|---|
| | 331 | t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); |
|---|
| | 332 | t.eq(lastNode.type, "text/css", "node added has type set to text/css"); |
|---|
| | 333 | t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); |
|---|
| | 334 | } |
|---|
| | 335 | function test_01_Map_customTheme(t) { |
|---|
| | 336 | t.plan(5); |
|---|
| | 337 | |
|---|
| | 338 | var head = document.getElementsByTagName('head')[0]; |
|---|
| | 339 | var nodeCount = head.childNodes.length; |
|---|
| | 340 | |
|---|
| | 341 | var options = {theme: 'foo'}; |
|---|
| | 342 | map = new OpenLayers.Map('map', options); |
|---|
| | 343 | |
|---|
| | 344 | var lastNode = head.childNodes[head.childNodes.length - 1]; |
|---|
| | 345 | |
|---|
| | 346 | t.eq(nodeCount + 1, head.childNodes.length, "with custom theme, a node is added to document head" ); |
|---|
| | 347 | t.eq(lastNode.tagName, "LINK", "node added is a link element"); |
|---|
| | 348 | t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet"); |
|---|
| | 349 | t.eq(lastNode.type, "text/css", "node added has type set to text/css"); |
|---|
| | 350 | t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme"); |
|---|
| | 351 | } |
|---|
| | 352 | function test_01_Map_noTheme(t) { |
|---|
| | 353 | t.plan(1); |
|---|
| | 354 | |
|---|
| | 355 | var head = document.getElementsByTagName('head')[0]; |
|---|
| | 356 | var nodeCount = head.childNodes.length; |
|---|
| | 357 | |
|---|
| | 358 | var options = {theme: null}; |
|---|
| | 359 | map = new OpenLayers.Map('map', options); |
|---|
| | 360 | |
|---|
| | 361 | t.eq(nodeCount, head.childNodes.length, "with no theme, a node is not added to document head" ); |
|---|
| | 362 | } |
|---|
| | 363 | |
|---|