describe('Entwine', function(){ beforeEach(function() { $.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE; $.entwine.synchronous_mode(true); $('body').append('
'); }); afterEach(function(){ $('#dom_test').remove(); $.entwine.synchronous_mode(false); }); describe('Synchronous Mode', function(){ beforeEach(function(){ // $.entwine.clear_all_rules(); }); it('can modify the DOM in onmatch', function(){ $('#a').entwine({ onmatch: function(){this.append('
');} }); $('#dom_test').append('
'); expect($('#a .appended').length).toEqual(1); }); it('can modify the DOM in onunmatch', function(){ $('#a').entwine({ onmatch: function(){ /* NOP */ }, onunmatch: function(){$('#dom_test').append('
');} }); $('#dom_test').append('
'); $('#dom_test').find('#a').remove(); expect($('#dom_test .appended').length).toEqual(1); }); }); });