ModuleLoader.require([ "tinymce/InsertList", "tinymce/html/Node", "tinymce/html/DomParser", "tinymce/dom/DOMUtils" ], function(InsertList, Node, DomParser, DOMUtils) { module("tinymce.InsertList", {}); var createFragment = function(html) { var parser = new DomParser({validate: false}); var fragment = parser.parse(html); return fragment; }; var createDomFragment = function(html) { return DOMUtils.DOM.createFragment(html); }; test('isListFragment', function() { equal(InsertList.isListFragment(createFragment('')), true); equal(InsertList.isListFragment(createFragment('
  1. x
')), true); equal(InsertList.isListFragment(createFragment('')), true); equal(InsertList.isListFragment(createFragment('')), true); equal(InsertList.isListFragment(createFragment('
')), false); }); test('listItems', function() { var list = createDomFragment('').firstChild; equal(InsertList.listItems(list).length, 3); equal(InsertList.listItems(list)[0].nodeName, 'LI'); }); test('trimListItems', function() { var list = createDomFragment('').firstChild; equal(InsertList.listItems(list).length, 3); equal(InsertList.trimListItems(InsertList.listItems(list)).length, 2); }); });