X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/4c81ad4075b0e8e67f984cce3494f9853179a9d6..80c653023eaa918f6b736e84d12e17d3c9c24d88:/modules/documentCanvas/tests/canvas.test.js
diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js
deleted file mode 100644
index a948787..0000000
--- a/modules/documentCanvas/tests/canvas.test.js
+++ /dev/null
@@ -1,115 +0,0 @@
-define([
-'libs/jquery-1.9.1.min',
-'libs/chai',
-'./utils.js',
-'modules/documentCanvas/canvas'
-], function($, chai, utils, canvas) {
-
- 'use strict';
-
- var assert = chai.assert;
-
- assert.xmlEqual = function(lhsText, rhsText) {
- var cleanLhs = utils.cleanUp(lhsText);
- var cleanRhs = utils.cleanUp(rhsText);
-
- var lhs = $(cleanLhs);
- var rhs = $(cleanRhs);
-
- this.equal(lhs.length, 1);
- this.equal(rhs.length, 1);
-
- lhs = lhs.get(0);
- rhs = rhs.get(0);
-
- var test = lhs.isEqualNode(rhs);
- if(!test) {
- console.log(cleanLhs);
- console.log(cleanRhs);
- }
- return this.ok(test, 'xmls are equal');
- };
-
- var retrievingTest = function(title, xml) {
- test(title, function() {
- var c = new canvas.Canvas(xml);
- assert.xmlEqual(c.toXML(), xml);
- });
- };
-
- suite('Basic document retrieving', function() {
- test('empty document', function() {
- var c = new canvas.Canvas('');
- assert.equal(c.toXML(), '');
- });
- retrievingTest('empty tag', '');
- retrievingTest('tag with content', '');
- retrievingTest('tag with class', '');
- });
-
- suite('Nodes', function() {
- test('getting nodes via selector', function() {
- var c = new canvas.Canvas('');
- var header = c.getNode({tag: 'header'})[0];
- assert.equal(header.tag, 'header');
- assert.equal(header.klass, 'some-class');
- });
-
- test('inserting after', function() {
- var c = new canvas.Canvas('');
- var header = c.getNode({tag: 'header'})[0];
- c.insertNode({place: 'after', context: header, tag: 'div', klass: 'some.class'});
- assert.xmlEqual(c.toXML(), '');
- });
-
- test('wrap text in node', function() {
- var c = new canvas.Canvas('');
- var header = c.getNode({tag: 'header'})[0];
- c.insertNode({place: 'wrapText', context: header, tag: 'span', klass: 'url', offsetStart: 1, offsetEnd: 6});
- assert.xmlEqual(c.toXML(), '');
- });
-
- test('split node', function() {
- var c = new canvas.Canvas('');
- var header = c.getNode({tag: 'header'})[0];
- c.splitNode({node: header, offset: 4});
- assert.xmlEqual(c.toXML(), '\
- '
- );
- });
-
- test('split node with subnodes', function() {
- var c = new canvas.Canvas('');
- var header = c.getNode({tag: 'header'})[0];
- c.splitNode({node: header, textNodeIdx: 0, offset: 5});
- assert.xmlEqual(c.toXML(), '\
- '
- );
- });
-
- test('list', function() {
- var c = new canvas.Canvas('');
- var div1 = c.getNode({tag:'div'})[0];
- var div2 = c.getNode({tag:'div'})[1];
-
- c.createList({start: div1, end: div2});
-
- assert.xmlEqual(c.toXML(), '\
- \
- \
-
Alice
\
-
has
\
-
a cat
\
-
\
- ');
-
- });
- });
-
-});
\ No newline at end of file