-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: render single whitelisted property as full-width (#366)
* feat: display full-width property if only one whitelisted * chore(test): add basic tests
- Loading branch information
1 parent
27bd90f
commit bac0f23
Showing
4 changed files
with
92 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import "../src/main"; | ||
|
||
describe("Stacinfo", () => { | ||
const testBody = (json) => { | ||
cy.intercept("/collection*", { | ||
body: json, | ||
}); | ||
}; | ||
|
||
it("loads stacinfo", () => { | ||
testBody({ | ||
type: "Collection", | ||
}); | ||
cy.mount( | ||
` | ||
<eox-stacinfo for="/collection"></eox-stacinfo>` | ||
).as("eox-stacinfo"); | ||
cy.get("eox-stacinfo").shadow(); | ||
}); | ||
|
||
it("creates list items for all properties", () => { | ||
const body = { | ||
type: "Collection", | ||
title: "Foobar", | ||
id: "foobar", | ||
}; | ||
testBody(body); | ||
cy.mount( | ||
` | ||
<eox-stacinfo for="/collection"></eox-stacinfo>` | ||
).as("eox-stacinfo"); | ||
cy.get("eox-stacinfo") | ||
.shadow() | ||
.within(() => { | ||
cy.get("li", { multiple: true }).should( | ||
"have.length", | ||
Object.keys(body).length | ||
); | ||
}); | ||
}); | ||
|
||
it("creates a single-property class if only one property is whitelisted", () => { | ||
testBody({ | ||
type: "Collection", | ||
description: "Hello world!", | ||
}); | ||
cy.mount( | ||
` | ||
<eox-stacinfo | ||
for="/collection" | ||
properties='["description"]' | ||
></eox-stacinfo>` | ||
).as("eox-stacinfo"); | ||
cy.get("eox-stacinfo") | ||
.shadow() | ||
.within(() => { | ||
cy.get("#properties ul.single-property").should("exist"); | ||
}); | ||
}); | ||
}); |