Skip to content

Commit 6bee33f

Browse files
authored
Merge branch 'main' into tokenizer-token-list-update
2 parents c6efa3c + a38752a commit 6bee33f

25 files changed

+1210
-778
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import MediaGallery from "../../src/MediaGallery.js";
2+
import MediaGalleryItem from "../../src/MediaGalleryItem.js";
3+
import type UI5Element from "@ui5/webcomponents-base";
4+
5+
describe("MediaGallery - getFocusDomRef Method", () => {
6+
it("should return undefined when the MediaGallery is empty", () => {
7+
cy.mount(<MediaGallery></MediaGallery>);
8+
9+
cy.get<MediaGallery>("[ui5-media-gallery]")
10+
.then(($el) => {
11+
expect($el[0].getFocusDomRef()).to.be.undefined;
12+
});
13+
});
14+
15+
it("should return first item if no item was focused before", () => {
16+
cy.mount(
17+
<MediaGallery showAllThumbnails>
18+
<MediaGalleryItem id="item1">
19+
<img src="./img/HT-1000.jpg"/>
20+
<img src="./img/HT-1000.jpg" slot="thumbnail"/>
21+
</MediaGalleryItem>
22+
<MediaGalleryItem id="item2">
23+
<img src="./img/HT-1000.jpg"/>
24+
<img src="./img/HT-1000.jpg" slot="thumbnail"/>
25+
</MediaGalleryItem>
26+
</MediaGallery>
27+
);
28+
29+
cy.get<UI5Element>("[ui5-media-gallery], #item1")
30+
.then(($el) => {
31+
const mg = $el[0];
32+
const item = $el[1];
33+
expect(mg.getFocusDomRef()).to.equal(item.getFocusDomRef());
34+
});
35+
});
36+
37+
it("should return last focused item in the MediaGallery", () => {
38+
cy.mount(
39+
<MediaGallery>
40+
<MediaGalleryItem id="item1">
41+
<img src="./img/HT-1000.jpg"/>
42+
<img src="./img/HT-1000.jpg" slot="thumbnail"/>
43+
</MediaGalleryItem>
44+
<MediaGalleryItem id="item2">
45+
<img src="./img/HT-1000.jpg"/>
46+
<img src="./img/HT-1000.jpg" slot="thumbnail"/>
47+
</MediaGalleryItem>
48+
</MediaGallery>
49+
);
50+
51+
cy.get("#item2").click();
52+
cy.get("#item2").should("be.focused");
53+
54+
cy.get<UI5Element>("[ui5-media-gallery], #item2")
55+
.then(($el) => {
56+
const mg = $el[0];
57+
const item = $el[1];
58+
59+
expect(mg.getFocusDomRef()).to.equal(item.getFocusDomRef());
60+
});
61+
});
62+
});

packages/fiori/cypress/specs/Search.cy.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,32 @@ describe("Properties", () => {
389389
.find("ui5-avatar")
390390
.should("be.visible");
391391
});
392+
393+
it("displays item's delete button on hover", () => {
394+
cy.mount(
395+
<Search>
396+
<SearchItem text="Item 1"/>
397+
<SearchItem text="Item 2"/>
398+
</Search>
399+
);
400+
401+
cy.get("[ui5-search]")
402+
.shadow()
403+
.find("input")
404+
.realClick();
405+
406+
cy.realPress("I");
407+
408+
cy.get("[ui5-search-item]")
409+
.eq(1)
410+
.realHover();
411+
412+
cy.get("[ui5-search-item]")
413+
.eq(1)
414+
.shadow()
415+
.find(".ui5-search-item-selected-delete")
416+
.should("be.visible");
417+
});
392418
});
393419

394420
describe("Events", () => {

0 commit comments

Comments
 (0)