From 4ac9bc0d440f080281210f023fb9d8c1da42dadd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 27 Jun 2013 13:35:16 +0200 Subject: [PATCH] Fixing canvas.nodeInsideList --- modules/documentCanvas/canvas.js | 2 +- modules/documentCanvas/tests/canvas.test.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.20.1