diff options
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/editor/style_test.html')
-rw-r--r-- | contexts/data/lib/closure-library/closure/goog/editor/style_test.html | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/editor/style_test.html b/contexts/data/lib/closure-library/closure/goog/editor/style_test.html deleted file mode 100644 index e1bebcc..0000000 --- a/contexts/data/lib/closure-library/closure/goog/editor/style_test.html +++ /dev/null @@ -1,177 +0,0 @@ -<!DOCTYPE html> -<!-- - All Rights Reserved. - - Author: nicksantos@google.com (Nick Santos) ---> -<html> -<!-- -Copyright 2007 The Closure Library Authors. All Rights Reserved. - -Use of this source code is governed by the Apache License, Version 2.0. -See the COPYING file for details. ---> -<head> -<meta http-equiv="X-UA-Compatible" content="IE=edge"> -<title>Closure Unit Tests - goog.editor.style</title> -<script src="../base.js"></script> -<script> - goog.require('goog.editor.BrowserFeature'); - goog.require('goog.editor.style'); - goog.require('goog.events.EventHandler'); - goog.require('goog.events.EventType'); - goog.require('goog.testing.LooseMock'); - goog.require('goog.testing.dom'); - goog.require('goog.testing.jsunit'); - goog.require('goog.testing.mockmatchers'); -</script> -</head> -<body> -<script> -var parentNode = null; -var childNode1 = null; -var childNode2 = null; -var childNode3 = null; -var gChildWsNode1 = null; -var gChildTextNode1 = null; -var gChildNbspNode1 = null; -var gChildMixedNode1 = null; -var gChildWsNode2a = null; -var gChildWsNode2b = null; -var gChildTextNode3a = null; -var gChildWsNode3 = null; -var gChildTextNode3b = null; - -var $dom = goog.dom.createDom; -var $text = goog.dom.createTextNode; - -function setUpGetNodeFunctions() { - parentNode = $dom( - 'p', {id: 'parentNode'}, - childNode1 = $dom('div', null, - gChildWsNode1 = $text(' \t\r\n'), - gChildTextNode1 = $text('Child node'), - gChildNbspNode1 = $text('\u00a0'), - gChildMixedNode1 = $text('Text\n plus\u00a0')), - childNode2 = $dom('div', null, - gChildWsNode2a = $text(''), - gChildWsNode2b = $text(' ')), - childNode3 = $dom('div', null, - gChildTextNode3a = $text('I am a grand child'), - gChildWsNode3 = $text(' \t \r \n'), - gChildTextNode3b = $text('I am also a grand child'))); - - document.body.appendChild(parentNode); -} - -function tearDownGetNodeFunctions() { - document.body.removeChild(parentNode); - - parentNode = null; - childNode1 = null; - childNode2 = null; - childNode3 = null; - gChildWsNode1 = null; - gChildTextNode1 = null; - gChildNbspNode1 = null; - gChildMixedNode1 = null; - gChildWsNode2a = null; - gChildWsNode2b = null; - gChildTextNode3a = null; - gChildWsNode3 = null; - gChildTextNode3b = null; -} - -/** - * Test isBlockLevel with a node that is block style and a node that is not - */ -function testIsDisplayBlock() { - assertTrue('Body is block style', - goog.editor.style.isDisplayBlock(document.body)); - var tableNode = $dom('table'); - assertFalse('Table is not block style', - goog.editor.style.isDisplayBlock(tableNode)); -} - -/** - * Test that isContainer returns true when the node is of non-inline HTML and - * false when it is not - */ -function testIsContainer() { - var tableNode = $dom('table'); - var liNode = $dom('li'); - var textNode = $text('I am text'); - document.body.appendChild(textNode); - - assertTrue('Table is a container', - goog.editor.style.isContainer(tableNode)); - assertTrue('Body is a container', - goog.editor.style.isContainer(document.body)); - assertTrue('List item is a container', - goog.editor.style.isContainer(liNode)); - assertFalse('Text node is not a container', - goog.editor.style.isContainer(textNode)); -} - -/** - * Test that getContainer properly returns the node itself if it is a - * container, an ancestor node if it is a container, and null otherwise - */ -function testGetContainer() { - setUpGetNodeFunctions(); - assertEquals('Should return self', childNode1, - goog.editor.style.getContainer(childNode1)); - assertEquals('Should return parent', childNode1, - goog.editor.style.getContainer(gChildWsNode1)); - assertNull('Document has no ancestors', - goog.editor.style.getContainer(document)); - tearDownGetNodeFunctions(); -} - - -function testMakeUnselectable() { - var div = goog.dom.createElement(goog.dom.TagName.DIV); - div.innerHTML = - '<div>No input</div>' + - '<p><input type="checkbox">Checkbox</p>' + - '<span><input type="text"></span>'; - document.body.appendChild(div); - - var eventHandler = new goog.testing.LooseMock(goog.events.EventHandler); - if (goog.editor.BrowserFeature.HAS_UNSELECTABLE_STYLE) { - eventHandler.listen(div, goog.events.EventType.MOUSEDOWN, - goog.testing.mockmatchers.isFunction, true); - } - eventHandler.$replay(); - - - var childDiv = div.firstChild; - var p = div.childNodes[1]; - var span = div.lastChild; - var checkbox = p.firstChild; - var text = span.firstChild; - - goog.editor.style.makeUnselectable(div, eventHandler); - - assertEquals( - 'For browsers with non-overridable selectability, the root should be ' + - 'selectable. Otherwise it should be unselectable.', - !goog.editor.BrowserFeature.HAS_UNSELECTABLE_STYLE, - goog.style.isUnselectable(div)); - assertTrue(goog.style.isUnselectable(childDiv)); - assertTrue(goog.style.isUnselectable(p)); - assertTrue(goog.style.isUnselectable(checkbox)); - - assertEquals( - 'For browsers with non-overridable selectability, the span will be ' + - 'selectable. Otherwise it will be unselectable. ', - !goog.editor.BrowserFeature.HAS_UNSELECTABLE_STYLE, - goog.style.isUnselectable(span)); - assertFalse(goog.style.isUnselectable(text)); - - eventHandler.$verify(); -} - -</script> -</body> -</html> |