aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html')
-rw-r--r--contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html169
1 files changed, 0 insertions, 169 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html b/contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html
deleted file mode 100644
index f2e60af..0000000
--- a/contexts/data/lib/closure-library/closure/goog/editor/plugins/loremipsum_test.html
+++ /dev/null
@@ -1,169 +0,0 @@
-<!DOCTYPE html>
-
-<!--
-All Rights Reserved.
-
-@author nicksantos@google.com (Nick Santos)
--->
-
-<html>
-<!--
-Copyright 2008 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>goog.editor.plugins.LoremIpsum Tests</title>
-<script type="text/javascript" src="../../base.js"></script>
-<script type="text/javascript">
- goog.require('goog.dom');
- goog.require('goog.editor.Command');
- goog.require('goog.editor.Field');
- goog.require('goog.editor.plugins.LoremIpsum');
- goog.require('goog.testing.jsunit');
- goog.require('goog.userAgent');
-</script>
-</head>
-<body>
-
-<div id='root'><div id='field'></div></div>
-
-<script type="text/javascript">
-
-var FIELD;
-var PLUGIN;
-var HTML;
-var UPPERCASE_CONTENTS = '<P>THE OWLS ARE NOT WHAT THEY SEEM.</P>';
-
-function setUp() {
- HTML = goog.dom.getElement('root').innerHTML;
-
- FIELD = new goog.editor.Field('field');
-
- PLUGIN = new goog.editor.plugins.LoremIpsum(
- 'The owls are not what they seem.');
- FIELD.registerPlugin(PLUGIN);
-}
-
-function tearDown() {
- FIELD.dispose();
- goog.dom.getElement('root').innerHTML = HTML;
-}
-
-function testQueryUsingLorem() {
- FIELD.makeEditable();
-
- assertTrue(FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
- FIELD.setHtml(true, 'fresh content', false, true);
- assertFalse(FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
-}
-
-function testUpdateLoremIpsum() {
- goog.dom.getElement('field').innerHTML = 'stuff';
-
- var loremPlugin = FIELD.getPluginByClassId('LoremIpsum');
- FIELD.makeEditable();
- var content = '<div>foo</div>';
-
- FIELD.setHtml(false, '', false, /* Don't update lorem */ false);
- assertFalse('Field started with content, lorem must not be enabled.',
- FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
- FIELD.execCommand(goog.editor.Command.UPDATE_LOREM);
- assertTrue('Field was set to empty, update must turn on lorem ipsum',
- FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
-
- FIELD.unregisterPlugin(loremPlugin);
- FIELD.setHtml(false, content, false,
- /* Update (turn off) lorem */ true);
- FIELD.setHtml(false, '', false, /* Don't update lorem */ false);
- FIELD.execCommand(goog.editor.Command.UPDATE_LOREM);
- assertFalse('Field with no lorem message must not use lorem ipsum',
- FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
- FIELD.registerPlugin(loremPlugin);
-
- FIELD.setHtml(false, content, false, true);
- FIELD.setHtml(false, '', false, false);
- goog.editor.Field.setActiveFieldId(FIELD.id);
- FIELD.execCommand(goog.editor.Command.UPDATE_LOREM);
- assertFalse('Active field must not use lorem ipsum',
- FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
- goog.editor.Field.setActiveFieldId(null);
-
- FIELD.setHtml(false, content, false, true);
- FIELD.setHtml(false, '', false, false);
- FIELD.setModalMode(true);
- FIELD.execCommand(goog.editor.Command.UPDATE_LOREM);
- assertFalse('Must not turn on lorem ipsum while a dialog is open.',
- FIELD.queryCommandValue(goog.editor.Command.USING_LOREM));
- FIELD.setModalMode(true);
-
- FIELD.dispose();
-}
-
-function testLoremIpsumAndGetCleanContents() {
- goog.dom.getElement('field').innerHTML = 'This is a field';
- FIELD.makeEditable();
-
- // test direct getCleanContents
- assertEquals('field reported wrong contents', 'This is a field',
- FIELD.getCleanContents());
-
- // test indirect getCleanContents
- var contents = FIELD.getCleanContents();
- assertEquals('field reported wrong contents', 'This is a field', contents);
-
- // set field html, but explicitly forbid converting to lorem ipsum text
- FIELD.setHtml(false, '&nbsp;', true, false /* no lorem */);
- assertEquals('field contains unexpected contents', getNbsp(),
- FIELD.getElement().innerHTML);
- assertEquals('field reported wrong contents', getNbsp(),
- FIELD.getCleanContents());
-
- // now set field html allowing lorem
- FIELD.setHtml(false, '&nbsp;', true, true /* lorem */);
- assertEquals('field reported wrong contents', goog.string.Unicode.NBSP,
- FIELD.getCleanContents());
- assertEquals('field contains unexpected contents', UPPERCASE_CONTENTS,
- FIELD.getElement().innerHTML.toUpperCase());
-}
-
-function testLoremIpsumAndGetCleanContents2() {
- // make a field blank before we make it editable, and then check
- // that making it editable activates lorem.
- assert('field is editable', FIELD.isUneditable());
- goog.dom.getElement('field').innerHTML = ' ';
-
- FIELD.makeEditable();
- assertEquals('field contains unexpected contents',
- UPPERCASE_CONTENTS, FIELD.getElement().innerHTML.toUpperCase());
-
- FIELD.makeUneditable();
- assertEquals('field contains unexpected contents',
- UPPERCASE_CONTENTS, goog.dom.getElement('field').innerHTML.toUpperCase());
-}
-
-function testLoremIpsumInClickToEditMode() {
- // in click-to-edit mode, trogedit manages the editable state of the editor,
- // so we must manage lorem ipsum in uneditable mode too.
- FIELD.makeEditable();
-
- assertEquals('field contains unexpected contents',
- UPPERCASE_CONTENTS, FIELD.getElement().innerHTML.toUpperCase());
-
- FIELD.makeUneditable();
- assertEquals('field contains unexpected contents',
- UPPERCASE_CONTENTS, goog.dom.getElement('field').innerHTML.toUpperCase());
-}
-
-function getNbsp() {
- // On WebKit (pre-528) and Opera, &nbsp; shows up as its unicode character in
- // innerHTML under some circumstances.
- return (goog.userAgent.WEBKIT && !goog.userAgent.isVersion('528')) ||
- goog.userAgent.OPERA ? '\u00a0' : '&nbsp;';
-}
-
-</script>
-</body>
-</html>