Precise DOM morphing
morphing typescript dom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'main' of https://github.com/joeldrapper/morphlite

+65
+65
test/something.test.js
··· 513 513 expect(a.outerHTML).to.equal(b.outerHTML); 514 514 }); 515 515 }); 516 + 517 + describe("selectables", () => { 518 + it('should append nodes', async () => { 519 + const a = await fixture(html`<select></select>`); 520 + const b = await fixture(html`<select><option>1</option><option>2</option><option>3</option><option>4</option></select>`); 521 + 522 + morph(a, b); 523 + 524 + expect(a.outerHTML).to.equal(b.outerHTML); 525 + }); 526 + 527 + it('should append nodes (including optgroups)', async () => { 528 + const a = await fixture(html`<select></select>`); 529 + const b = await fixture(html`<select><optgroup><option>1</option><option>2</option></optgroup><option>3</option><option>4</option></select>`); 530 + 531 + morph(a, b); 532 + 533 + expect(a.outerHTML).to.equal(b.outerHTML); 534 + }); 535 + 536 + it('should remove nodes', async () => { 537 + const a = await fixture(html`<select><option>1</option><option>2</option><option>3</option><option>4</option></select>`); 538 + const b = await fixture(html`<select></select>`); 539 + 540 + morph(a, b); 541 + 542 + expect(a.outerHTML).to.equal(b.outerHTML); 543 + }); 544 + 545 + it('should remove nodes (including optgroups)', async () => { 546 + const a = await fixture(html`<select><optgroup><option>1</option><option>2</option></optgroup><option>3</option><option>4</option></select>`); 547 + const b = await fixture(html`<select></select>`); 548 + 549 + morph(a, b); 550 + 551 + expect(a.outerHTML).to.equal(b.outerHTML); 552 + }); 553 + 554 + it('should add selected', async () => { 555 + const a = await fixture(html`<select><option>1</option><option>2</option></select>`); 556 + const b = await fixture(html`<select><option>1</option><option selected>2</option></select>`); 557 + 558 + morph(a, b); 559 + 560 + expect(a.outerHTML).to.equal(b.outerHTML); 561 + }); 562 + 563 + it('should add selected (xhtml)', async () => { 564 + const a = await fixture(html`<select><option>1</option><option>2</option></select>`); 565 + const b = await fixture(html`<select><option>1</option><option selected="selected">2</option></select>`); 566 + 567 + morph(a, b); 568 + 569 + expect(a.outerHTML).to.equal(b.outerHTML); 570 + }); 571 + 572 + it('should switch selected', async () => { 573 + const a = await fixture(html`<select><option selected="selected">1</option><option>2</option></select>`); 574 + const b = await fixture(html`<select><option>1</option><option selected="selected">2</option></select>`); 575 + 576 + morph(a, b); 577 + 578 + expect(a.outerHTML).to.equal(b.outerHTML); 579 + }); 580 + }); 516 581 });