/*****************************************************************************
*
* Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
*
* This software is distributed under the terms of the Kupu
* License. See LICENSE.txt for license text. For a list of Kupu
* Contributors see CREDITS.txt.
*
*****************************************************************************/
// $Id: test_plone.js,v 1.1 2005/08/30 17:10:23 dwinter Exp $
// Various tests for html -> xhtml processing.
function KupuPloneTestCase() {
SelectionTestCase.apply(this);
this.base_setUp = this.setUp;
this.name = 'KupuPloneTestCase';
this.incontext = function(s) {
return '
test'+s+'';
}
this.verifyResult = function(actual, expected) {
//var expected = this.incontext(exp);
if (actual == expected)
return;
var context = /test<\/title><\/head>(.*)<\/body><\/html>/;
if (context.test(actual) && context.test(expected)) {
var a = context.exec(actual)[1];
var e = context.exec(expected)[1];
throw('Assertion failed: ' + a + ' != ' + e);
}
throw('Assertion failed: ' + actual + ' != ' + expected);
}
this.setUp = function() {
this.base_setUp();
this.editor = new KupuEditor(this.kupudoc, {}, null);
this.ui = new PloneKupuUI('kupu-tb-styles');
this.ui.editor = this.editor;
};
this.testRelativeLinks1 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost/cms/folder/';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testRelativeLinks2 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost/cms/folder/';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testRelativeLinks3 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost/cms/folder/';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testRelativeLinks4 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost:9080/plone/Members/admin/art1';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testRelativeLinks5 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost:9080/plone/Members/admin/art1';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testRelativeLinks6 = function() {
var data = '[1]';
var expected = '[1]';
var base = 'http://localhost:9080/plone/Members/admin/art1';
var actual = this.editor.makeLinksRelative(data, base);
this.verifyResult(actual, expected);
}
this.testSetTextStyle = function() {
var data = 'line 1
line 2
line 3
';
// select .....................................|e 2line|...
var expected = '
line 1
line 2
line 3
';
this.body.innerHTML = data;
this._setSelection(10, null, 18, null, 'e 2line');
this.ui.setTextStyle('h2');
this.assertEquals(this._cleanHtml(this.body.innerHTML), expected);
}
}
KupuPloneTestCase.prototype = new SelectionTestCase;