-
Notifications
You must be signed in to change notification settings - Fork 13.4k
refactor(searchbar): update default styles for ionic theme #29917
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
Changes from 9 commits
2f6cf04
37d101e
2f857fa
8cbd786
4579aa8
8841115
12afd4a
bedac25
bc30669
781c533
81fde1f
8eb7331
682b233
127027c
614bf7b
739abe1
8d25e94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @use "../../themes/ionic/ionic.globals.scss" as globals; | ||
|
|
||
| // Ionic Searchbar | ||
| // -------------------------------------------------- | ||
|
|
||
| /// @prop - Size of the searchbar input search icon | ||
| $searchbar-ionic-input-search-icon-size: globals.$ionic-scale-400; | ||
|
|
||
| /// @prop - Size of the searchbar input clear icon | ||
| $searchbar-ionic-input-clear-icon-size: globals.$ionic-scale-400; | ||
|
|
||
| /// @prop - Gap between searchbar elements | ||
| $searchbar-ionic-gap: globals.$ionic-space-200; | ||
|
|
||
| /// @prop - Padding start of the searchbar | ||
| $searchbar-ionic-padding-start: calc( | ||
| globals.$ionic-space-400 + $searchbar-ionic-input-search-icon-size + $searchbar-ionic-gap | ||
| ); | ||
|
|
||
| /// @prop - Padding end of the searchbar | ||
| $searchbar-ionic-padding-end: calc( | ||
| globals.$ionic-space-400 + $searchbar-ionic-input-clear-icon-size + $searchbar-ionic-gap | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => | |
| }); | ||
| }); | ||
|
|
||
| configs().forEach(({ title, screenshot, config }) => { | ||
| configs({ modes: ['md', 'ios', 'ionic-md'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('searchbar: rendering'), () => { | ||
| test('should render searchbar', async ({ page }) => { | ||
| await page.setContent( | ||
|
|
@@ -143,19 +143,6 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | |
| await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-color`)); | ||
| }); | ||
|
|
||
| test('should render disabled searchbar', async ({ page }) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this to the states test folder. |
||
| await page.setContent( | ||
| ` | ||
| <ion-searchbar disabled="true"></ion-searchbar> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| const searchbar = page.locator('ion-searchbar'); | ||
|
|
||
| await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-disabled`)); | ||
| }); | ||
|
|
||
| test('should render custom search icon', async ({ page }) => { | ||
| await page.setContent( | ||
| ` | ||
|
|
@@ -199,7 +186,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c | |
| }); | ||
| }); | ||
|
|
||
| configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
| configs({ modes: ['md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('searchbar: cancel button alignment'), () => { | ||
| test('should align with the back button when used in a toolbar', async ({ page }, testInfo) => { | ||
| testInfo.annotations.push({ | ||
|
|
||
brandyscarney marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { configs, test } from '@utils/test/playwright'; | ||
|
|
||
| /** | ||
| * This behavior does not vary across directions. | ||
| */ | ||
| configs({ modes: ['md', 'ios', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('searchbar: disabled'), () => { | ||
| test('should render disabled searchbar', async ({ page }) => { | ||
| await page.setContent( | ||
| ` | ||
| <ion-searchbar disabled="true"></ion-searchbar> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| const searchbar = page.locator('ion-searchbar'); | ||
|
|
||
| await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-state-disabled`)); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| /** | ||
| * This behavior is only applicable to the `ionic-md` mode. | ||
| * This behavior does not vary across directions. | ||
| */ | ||
| configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('searchbar: focused'), () => { | ||
| test('should render focus ring on the component', async ({ page, pageUtils }) => { | ||
| await page.setContent( | ||
| ` | ||
| <style> | ||
| /* Add padding to the container to prevent the focus ring from being clipped */ | ||
| #container { | ||
| padding: 5px; | ||
| } | ||
| </style> | ||
|
|
||
| <div id="container"> | ||
| <ion-searchbar></ion-searchbar> | ||
| </div> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| await pageUtils.pressKeys('Tab'); // Focused on the input | ||
|
|
||
| const container = page.locator('#container'); | ||
|
|
||
| await expect(container).toHaveScreenshot(screenshot(`searchbar-state-focused`)); | ||
| }); | ||
|
|
||
| test('should render focus ring on the cancel button', async ({ page, pageUtils }) => { | ||
| await page.setContent( | ||
| ` | ||
| <ion-searchbar show-cancel-button="always"></ion-searchbar> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| await pageUtils.pressKeys('Tab'); // Focused on the input | ||
| await pageUtils.pressKeys('Tab'); // Focused on the cancel button | ||
|
|
||
| const searchbar = page.locator('ion-searchbar'); | ||
|
|
||
| await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-state-focused-cancel-button`)); | ||
| }); | ||
|
|
||
| test('should render focus ring on the clear button', async ({ page, pageUtils }) => { | ||
| await page.setContent( | ||
| ` | ||
| <ion-searchbar show-clear-button="always" value="Filled text"></ion-searchbar> | ||
| `, | ||
| config | ||
| ); | ||
|
|
||
| await pageUtils.pressKeys('Tab'); // Focused on the input | ||
| await pageUtils.pressKeys('Tab'); // Focused on the clear button | ||
|
|
||
| const searchbar = page.locator('ion-searchbar'); | ||
|
|
||
| await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-state-focused-clear-button`)); | ||
| }); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.