UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

66 lines (49 loc) 2.02 kB
describe('We should be able to ignore certain CSS classes that are not useful', function (t) { t.it('should record first unique CSS class by default', function (t) { document.body.innerHTML = '<div class="foo bar" style="background:#aaa;position:absolute;top:30px;left:30px;height:50px;width:50px"></div>'; var rec = new Siesta.Recorder.Recorder({ window : t.global, ignoreSynthetic : false, recordOffsets : false, shouldIgnoreDomElementId : function (id, target) { return Boolean(id.match('^ext-')); } }) rec.start(); t.chain( { click : '.foo' }, function (next) { var actions = rec.getRecordedActions(); t.is(actions.length, 1); t.is(actions[0].action, 'click'); t.isDeeply(actions[0].getTarget(), { type : 'css', target : '.foo' }); rec.stop(); } ) }); t.it('should respect ignoreCssClasses config', function (t) { document.body.innerHTML = '<div class="foo bar" style="background:#aaa;position:absolute;top:30px;left:30px;height:50px;width:50px"></div>'; var rec = new Siesta.Recorder.Recorder({ window : t.global, ignoreSynthetic : false, recordOffsets : false, ignoreCssClasses : [ 'foo' ], shouldIgnoreDomElementId : function (id, target) { return Boolean(id.match('^ext-')); } }) rec.start(); t.chain( { click : '.foo' }, function (next) { var actions = rec.getRecordedActions(); t.is(actions.length, 1); t.is(actions[0].action, 'click'); t.isDeeply(actions[0].getTarget(), { type : 'css', target : '.bar' }); rec.stop(); } ) }); });