-
Notifications
You must be signed in to change notification settings - Fork 275
feat(ui5-shellbar-search): initial implementation #11398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a93c3d3
feat(ui5-shellbar-search): initial implementation
MapTo0 e82238c
fix: review feedback
MapTo0 8ab4e3c
fix: review feddback
MapTo0 898440a
Merge remote-tracking branch 'origin/main' into shellbar-search-compo…
MapTo0 28f7737
fix: tests
MapTo0 54b5a76
fix: test renaming
MapTo0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,65 @@ | ||
import ShellBarSearch from "../../src/ShellBarSearch.js"; | ||
import { | ||
SHELLBAR_SEARCH_COLLAPSED, | ||
SEARCH_FIELD_SEARCH_ICON, | ||
SHELLBAR_SEARCH_EXPANDED, | ||
} from "../../src/generated/i18n/i18n-defaults.js"; | ||
|
||
describe("Behaviour", () => { | ||
it ("Toggles collapsed property upon icon press", () => { | ||
cy.mount(<ShellBarSearch />); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-icon]") | ||
.as("searchIcon"); | ||
|
||
cy.get("@searchIcon") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("have.prop", "collapsed", true); | ||
|
||
cy.get("@searchIcon") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("not.have.a.property", "collapsed"); | ||
}); | ||
|
||
it ("Tests icon tooltips for diffrent states", () => { | ||
cy.mount(<ShellBarSearch />); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-icon]") | ||
.as("searchIcon"); | ||
|
||
cy.get("@searchIcon") | ||
.should("have.attr", "accessible-name", SHELLBAR_SEARCH_EXPANDED.defaultText); | ||
|
||
cy.get("@searchIcon") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("have.prop", "collapsed", true); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-button]") | ||
.should("have.attr", "accessible-name", SHELLBAR_SEARCH_COLLAPSED.defaultText); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-button]") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("input") | ||
.type("test"); | ||
|
||
cy.get("@searchIcon") | ||
.should("have.attr", "accessible-name", SEARCH_FIELD_SEARCH_ICON.defaultText); | ||
}); | ||
}); |
This file contains hidden or 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,98 @@ | ||
import SearchItem from "../../src/SearchItem.js"; | ||
import ShellBarSearch from "../../src/ShellBarSearch.js"; | ||
|
||
describe("Mobile Behaviour", () => { | ||
beforeEach(() => { | ||
cy.ui5SimulateDevice(); | ||
}); | ||
|
||
it("Should not close dialog upong focus out", () => { | ||
cy.mount(<ShellBarSearch />); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-button]") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-responsive-popover] header input") | ||
.type("test"); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-responsive-popover] header input") | ||
.blur(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("have.prop", "open", true); | ||
}); | ||
|
||
it("Should select typed ahead item when typing", () => { | ||
cy.mount( | ||
<> | ||
<ShellBarSearch showClearIcon={true}> | ||
<SearchItem text="Item 1" /> | ||
<SearchItem text="Item 2" /> | ||
<SearchItem text="Item 3" /> | ||
<SearchItem text="Item 4" /> | ||
<SearchItem text="Item 5" /> | ||
<SearchItem text="Item 6" /> | ||
</ShellBarSearch> | ||
</> | ||
); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-button]") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("have.prop", "open", true); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-responsive-popover] header input") | ||
.type("item 1"); | ||
|
||
cy.get("[ui5-search-item]:first") | ||
.should("have.attr", "selected"); | ||
}); | ||
|
||
it("Should type ahead internal input", () => { | ||
cy.mount( | ||
<> | ||
<ShellBarSearch showClearIcon={true}> | ||
<SearchItem text="Item 1" /> | ||
<SearchItem text="Item 2" /> | ||
<SearchItem text="Item 3" /> | ||
<SearchItem text="Item 4" /> | ||
<SearchItem text="Item 5" /> | ||
<SearchItem text="Item 6" /> | ||
</ShellBarSearch> | ||
</> | ||
); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-button]") | ||
.realClick(); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-responsive-popover] header input") | ||
.type("ite"); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.shadow() | ||
.find("[ui5-responsive-popover] header input") | ||
.should("have.value", "Item 1"); | ||
}); | ||
|
||
it("is collapsed by default", () => { | ||
cy.mount(<ShellBarSearch />); | ||
|
||
cy.get("[ui5-shellbar-search]") | ||
.should("have.prop", "collapsed", true); | ||
}); | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.