Skip to content

Commit eb276c9

Browse files
committed
test: add tests for custom base uri slot
Signed-off-by: Leandro Bauret <[email protected]>
1 parent e465dde commit eb276c9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

test/api-console.basic.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ describe('<api-console>', function() {
2929
return (await fixture(`<api-console allowExtensionBanner page="request"></api-console>`));
3030
}
3131

32+
async function customBaseUriSlotFixture() {
33+
return (await fixture(`<api-console page="request"><anypoint-item slot="custom-base-uri"
34+
value="http://customServer.com">http://customServer.com</anypoint-item></api-console>`));
35+
}
36+
3237
describe('RAML aware', () => {
3338
it('Adds raml-aware to the DOM if aware is set', async () => {
3439
const element = await awareFixture();
@@ -430,4 +435,33 @@ describe('<api-console>', function() {
430435
assert.isFalse(banner.hasAttribute('active'), 'banner is not active');
431436
});
432437
});
438+
439+
describe('Custom baseUri slot', () => {
440+
describe('with requestFixture', () => {
441+
let element;
442+
beforeEach(async () => {
443+
element = await requestFixture();
444+
});
445+
446+
it('should render empty extra servers slot', () => {
447+
assert.exists(element.shadowRoot.querySelector('slot[name="custom-base-uri"]'));
448+
assert.lengthOf(element.shadowRoot.querySelector('slot[name="custom-base-uri"]').assignedNodes(), 0)
449+
});
450+
});
451+
452+
describe('with customBaseUriSlot fixture', () => {
453+
let element;
454+
beforeEach(async () => {
455+
element = await customBaseUriSlotFixture();
456+
});
457+
458+
it('should render extra servers slot', () => {
459+
assert.exists(element.shadowRoot.querySelector('slot[name="custom-base-uri"]'));
460+
});
461+
462+
it('should have assigned node to slot', () => {
463+
assert.lengthOf(element.shadowRoot.querySelector('slot[name="custom-base-uri"]').assignedNodes(), 1);
464+
});
465+
});
466+
});
433467
});

0 commit comments

Comments
 (0)