-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate more base tests to Cypress (#9849)
- Loading branch information
Showing
8 changed files
with
123 additions
and
93 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/main/cypress/specs/base/IgnoreCustomElements.cy.ts
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,35 @@ | ||
import { html } from "lit"; | ||
import "../../../src/Card.js"; | ||
import "../../../src/CardHeader.js"; | ||
|
||
import { ignoreCustomElements, shouldIgnoreCustomElement } from "@ui5/webcomponents-base/dist/IgnoreCustomElements.js"; | ||
|
||
ignoreCustomElements("app-"); | ||
ignoreCustomElements("my-"); | ||
|
||
describe("Ignore Custom Elements", () => { | ||
it("tests shouldIgnoreCustomElement method", () => { | ||
cy.mount(html`<ui5-card> | ||
<ui5-card-header | ||
slot="header" | ||
status="4 of 10" | ||
title-text="Product"> | ||
</ui5-card-header> | ||
<app-trip-calendar class="myCard-trip-calendar"></app-trip-calendar> | ||
<my-trip-calendar class="myCard-trip-calendar"></app-trip-calendar> | ||
</ui5-card>`); | ||
|
||
cy.wrap({ shouldIgnoreCustomElement }) | ||
.invoke("shouldIgnoreCustomElement", "app-trip-calendar") | ||
.should("be.true"); | ||
|
||
cy.wrap({ shouldIgnoreCustomElement }) | ||
.invoke("shouldIgnoreCustomElement", "my-trip-calendar") | ||
.should("be.true"); | ||
|
||
cy.wrap({ shouldIgnoreCustomElement }) | ||
.invoke("shouldIgnoreCustomElement", "ui5-card-header") | ||
.should("be.false"); | ||
}); | ||
}); |
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,31 @@ | ||
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js"; | ||
import "../../../src/Button.js"; | ||
|
||
describe("InvisibleMessage", () => { | ||
it("Initial rendering", () => { | ||
cy.get(".ui5-invisiblemessage-polite") | ||
.should("exist"); | ||
|
||
cy.get(".ui5-invisiblemessage-assertive") | ||
.should("exist"); | ||
}); | ||
|
||
it("String annoucement", () => { | ||
cy.wrap({ announce }) | ||
.invoke("announce", "announcement", "Polite"); | ||
cy.wrap({ announce }) | ||
.invoke("announce", "announcement", "Assertive"); | ||
|
||
// assert | ||
cy.get(".ui5-invisiblemessage-polite") | ||
.should("contain", "announcement"); | ||
cy.get(".ui5-invisiblemessage-assertive") | ||
.should("contain", "announcement"); | ||
|
||
// assert - announcement is cleared | ||
cy.get(".ui5-invisiblemessage-polite") | ||
.should("not.contain", "announcement"); | ||
cy.get(".ui5-invisiblemessage-assertive") | ||
.should("not.contain", "announcement"); | ||
}); | ||
}); |
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,55 @@ | ||
import { setEnableDefaultTooltips } from "@ui5/webcomponents-base/dist/config/Tooltips.js"; | ||
import { html } from "lit"; | ||
import "../../../src/Icon.js"; | ||
import "../../../src/Button.js"; | ||
import "../../../src/ToggleButton.js"; | ||
import "../../../src/SegmentedButton.js"; | ||
import "../../../src/SegmentedButtonItem.js"; | ||
import "../../../src/RatingIndicator.js"; | ||
|
||
setEnableDefaultTooltips(false); | ||
|
||
describe("Default Tooltips", () => { | ||
it("tests navigation", () => { | ||
cy.mount(html` | ||
<ui5-icon id="ic" name="settings"></ui5-icon> | ||
<ui5-button id="btn" icon="settings"></ui5-button> | ||
<ui5-rating-indicator id="rt" icon="settings"></ui5-rating-indicator> | ||
<ui5-toggle-button id="togglebtn" icon="settings"></ui5-toggle-button> | ||
<ui5-segmented-button id="segBtn"> | ||
<ui5-segmented-button-item id="segBtnItem" icon="add"></ui5-segmented-button-item> | ||
<ui5-segmented-button-item id="segBtnItem2" icon="settings"></ui5-segmented-button-item> | ||
<ui5-segmented-button-item id="segBtnItem3" icon="activate"></ui5-segmented-button-item> | ||
</ui5-segmented-button>`); | ||
|
||
cy.get("#ic") | ||
.shadow() | ||
.find("title") | ||
.should("not.exist"); | ||
|
||
cy.get("#btn") | ||
.shadow() | ||
.find(".ui5-button-icon") | ||
.should("not.have.attr", "title"); | ||
|
||
cy.get("#togglebtn") | ||
.shadow() | ||
.find(".ui5-button-icon") | ||
.should("not.have.attr", "title"); | ||
|
||
cy.get("#rt") | ||
.shadow() | ||
.find(".ui5-rating-indicator-root") | ||
.should("not.have.attr", "title"); | ||
|
||
cy.get("#segBtnItem") | ||
.shadow() | ||
.find(".ui5-segmented-button-item-root") | ||
.should("not.have.attr", "title"); | ||
|
||
cy.get("#segBtnItem") | ||
.shadow() | ||
.find(".ui5-segmented-button-item-icon") | ||
.should("not.have.attr", "title"); | ||
}); | ||
}); |
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
23 changes: 0 additions & 23 deletions
23
packages/main/test/specs/base/IgnoreCustomElements.spec.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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