X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/c986f6ebfd3d20bdc75ce00ee09bd2c716e0cb16..69be72cddc103e106ad80640a85f6a03def3f960:/modules/documentCanvas/tests/canvas.test.js diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js index 0589c11..57fb308 100644 --- a/modules/documentCanvas/tests/canvas.test.js +++ b/modules/documentCanvas/tests/canvas.test.js @@ -174,5 +174,76 @@ define([
cat
\ ')); }); + + test('checking if node is inside a list', function() { + var c = canvas.create(utils.cleanUp('\ +
\ +
\ +
alice \ +
cat
\ +
\ +
')); + assert.ok(c.nodeInsideList({node: c.findNodes({klass: 'item'})[1]}), 'item is inside a list'); + assert.ok(c.nodeInsideList({node: c.findNodes({tag: 'span'})[0]}), 'things nested in item are inside a list'); + }); + + test('moving items to nested list', function() { + var listHTML = utils.cleanUp('\ +
\ +
alice
\ +
cat
\ +
dog
\ +
bee
\ +
'); + var c = canvas.create(listHTML); + var items = c.findNodes({klass: 'item'}); + var cat_item = items[1]; + var dog_item = items[2]; + + c.listCreate({start: cat_item, end: dog_item}); + + assertDomEqual(c.getContent(), utils.cleanUp('\ +
\ +
alice
\ +
\ +
\ +
cat
\ +
dog
\ +
\ +
\ +
bee
\ +
' + )); + }); + + test('removing nested list', function() { + var nestedList = utils.cleanUp('\ +
\ +
alice
\ +
\ +
\ +
cat
\ +
dog
\ +
\ +
\ +
bee
\ +
'); + + var c = canvas.create(nestedList); + var dog_item = c.findNodes('[wlxml-class=list-items] [wlxml-class=list-items] > div')[1]; + assert.equal(dog_item.getContent(), 'dog'); + + c.listRemove({pointer: dog_item}); + + assertDomEqual(c.getContent(), utils.cleanUp('\ +
\ +
alice
\ +
cat
\ +
dog
\ +
bee
\ +
')); + + + }); }); }); \ No newline at end of file