Skip to content

Commit

Permalink
test(tree): update test to check correct icon prop
Browse files Browse the repository at this point in the history
  • Loading branch information
TremayneChrist committed Oct 22, 2021
1 parent ba430e2 commit 45a13a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/elements/src/tree/__test__/tree.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ describe('tree/Tree', () => {
await elementUpdated(el);

const firstElementIcon = el.children[0].shadowRoot.querySelector('[part="label-icon"]');
expect(firstElementIcon.attributes.src.value).to.equal('info');
expect(firstElementIcon.attributes.icon.value).to.equal('info');

const secondElementIcon = el.children[1].shadowRoot.querySelector('[part="label-icon"]');
expect(secondElementIcon.attributes.src.value).to.equal('');
expect(secondElementIcon.attributes.icon.value).to.equal('');

const thirdElementIcon = el.children[2].shadowRoot.querySelector('[part="label-icon"]');
expect(thirdElementIcon.attributes.src.value).to.equal('https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/icons/favorites.svg');
expect(thirdElementIcon.attributes.icon.value).to.equal('https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/icons/favorites.svg');

const forthElementIcon = el.children[3].shadowRoot.querySelector('[part="label-icon"]');
expect(forthElementIcon).to.equal(null);
Expand All @@ -100,17 +100,17 @@ describe('tree/Tree', () => {
el.composer.setItemPropertyValue(el.manager.visibleItems[0], 'icon', '');
await elementUpdated(el);
await nextFrame();
expect(iconElement.attributes.src.value).to.equal('');
expect(iconElement.attributes.icon.value).to.equal('');

el.composer.setItemPropertyValue(el.manager.visibleItems[0], 'icon', 'https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/icons/favorites.svg');
await elementUpdated(el);
await nextFrame();
expect(iconElement.attributes.src.value).to.equal('https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/icons/favorites.svg');
expect(iconElement.attributes.icon.value).to.equal('https://cdn.refinitiv.com/public/libs/elf/assets/elf-theme-halo/resources/icons/favorites.svg');

el.composer.setItemPropertyValue(el.manager.visibleItems[0], 'icon', 'buzz');
await elementUpdated(el);
await nextFrame();
expect(iconElement.attributes.src.value).to.equal('buzz');
expect(iconElement.attributes.icon.value).to.equal('buzz');

el.composer.setItemPropertyValue(el.manager.visibleItems[0], 'icon', undefined);
await elementUpdated(el);
Expand Down

0 comments on commit 45a13a6

Please sign in to comment.