From: Aleksander Ɓukasz Date: Thu, 27 Jun 2013 11:35:16 +0000 (+0200) Subject: Fixing canvas.nodeInsideList X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/4ac9bc0d440f080281210f023fb9d8c1da42dadd?ds=inline;hp=58f12279b796c932263a4cfad12c3f17695be02a Fixing canvas.nodeInsideList --- diff --git a/modules/documentCanvas/canvas.js b/modules/documentCanvas/canvas.js index 9ae3a53..d0629d3 100644 --- a/modules/documentCanvas/canvas.js +++ b/modules/documentCanvas/canvas.js @@ -193,7 +193,7 @@ Canvas.prototype.nodeInsideList = function(options) { if(options.node.getClass() === 'list-items' || options.node.getClass() === 'item') return true; var pointerElement = $(this.content.find('#' + options.node.getId())); - return pointerElement.parents('list-items, item').length > 0; + return pointerElement.parents('[wlxml-class=list-items], [wlxml-class=item]').length > 0; } return false; }; diff --git a/modules/documentCanvas/tests/canvas.test.js b/modules/documentCanvas/tests/canvas.test.js index afe777a..fc842e5 100644 --- a/modules/documentCanvas/tests/canvas.test.js +++ b/modules/documentCanvas/tests/canvas.test.js @@ -179,12 +179,12 @@ define([ var c = canvas.create(utils.cleanUp('\
\
\ -
alice
\ +
alice \
cat
\
\
')); - var item = c.findNodes({klass: 'item'})[1]; - assert.ok(c.nodeInsideList({node: item})); + 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'); }); }); }); \ No newline at end of file