describe("multi-swap extension", function() {
beforeEach(function () {
this.server = makeServer();
clearWorkArea();
});
afterEach(function () {
this.server.restore();
clearWorkArea();
});
it('swap only one element with default innerHTML', function () {
this.server.respondWith("GET", "/test", '
New A
');
var content = make('
Foo
Old A
');
var btn = make('');
btn.click();
this.server.respond();
should.equal(content.innerHTML, 'Foo
New A
');
});
it('swap multiple elements with outerHTML, beforeend, afterend, beforebegin and delete methods', function () {
this.server.respondWith("GET", "/test",
'
' +
'
New A
foo ' +
'
New B
bar ' +
'
New C
dummy ' +
'
New D
lorem ' +
'
TO DELETE
' +
'
'
);
var content = make(
'
Foo ' +
'
Old A
A ' +
'
Old B
B ' +
'
Old C
C ' +
'
Old D
D ' +
'
Old E
E ' +
'
'
);
var btn = make('');
btn.click();
this.server.respond();
should.equal(content.outerHTML,
'