Skip to content
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

Update Search behavior/styling #2974

Merged
merged 8 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
with:
component: true
install-command: npm i
browser: chrome
# build job
build:
needs: [install]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ yalc.lock
cypress/**/*.diff.png
cypress/videos
cypress/screenshots
cypress/downloads

# cache
.cache
Expand Down
19 changes: 17 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,32 @@ export default defineConfig({
addMatchImageSnapshotPlugin(on, config);
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--window-size=1280,720');
launchOptions.args = launchOptions.args.map((arg) => {
if (arg === '--headless=new') {
return '--headless';
}

return arg;
});
// Needs the extra 139 because of the cypress toolbar, this is the size of the window! not size of the viewport
launchOptions.args.push(`--window-size=1280,${720 + 139}`);
// force screen to be non-retina
launchOptions.args.push('--force-device-scale-factor=1');
// force screen to be retina (2800x2400 size)
// launchOptions.args.push('--force-device-scale-factor=2')
}

if (browser.name === 'electron' && browser.isHeadless) {
// fullPage screenshot size is 1280x720
launchOptions.preferences.width = 1280;
launchOptions.preferences.height = 720;
}

if (browser.name === 'firefox' && browser.isHeadless) {
launchOptions.args.push('--width=1280');
launchOptions.args.push('--height=720');
}

return launchOptions;
});
require('@cypress/code-coverage/task')(on, config);
return config;
Expand Down
2 changes: 2 additions & 0 deletions cypress/component/NotEntitledModal/NotEntitledModal.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ describe('NonEntitledModal', () => {
if (image) {
cy.get(`[src="${image}"]`).should('be.visible');
}
// make sure the scrollbar is hidden to ensure valid snapshot
cy.get('.pf-v5-c-modal-box__body').invoke('attr', 'style', 'overflow: hidden');
elem.matchImageSnapshot();
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const defaultOptions = {
updateSnapshots: false,
};

const defaultCommand = 'npm run cypress run -- --component --browser electron';
const defaultCommand = 'npm run cypress run -- --component --browser chrome';

if (argv.u || argv.update) {
defaultOptions.updateSnapshots = true;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ declare global {
}

Cypress.Commands.add('mount', mount)

// Example use:
// cy.mount(<MyComponent />)
4 changes: 2 additions & 2 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ const MemoizedHeader = memo(
</ToolbarItem>
)}
</ToolbarGroup>
<ToolbarGroup className="pf-v5-u-flex-grow-1 pf-v5-u-mr-0 pf-v5-u-mr-md-on-2xl" variant="filter-group">
<ToolbarGroup className="pf-v5-u-flex-grow-1 pf-v5-u-mr-0 pf-v5-u-mr-0-on-2xl" variant="filter-group">
<Suspense fallback={null}>
<SearchInput onStateChange={hideAllServices} />
</Suspense>
</ToolbarGroup>
<ToolbarGroup
className="pf-v5-m-icon-button-group pf-v5-u-ml-auto"
className="pf-v5-m-icon-button-group pf-v5-u-ml-auto pf-v5-u-mr-0"
visibility={{ default: 'hidden', '2xl': 'visible' }}
widget-type="InsightsToolbar"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Tools should render correctly 1`] = `
<div
class="pf-v5-c-toolbar__item pf-v5-u-mr-0 pf-v5-u-ml-sm"
class="pf-v5-c-toolbar__item pf-v5-u-mx-0"
>
<div
style="display: contents;"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ const Tools = () => {
return (
<>
{isNotificationsEnabled && (
<ToolbarItem className="pf-v5-u-mr-0 pf-v5-u-ml-sm">
<ToolbarItem className="pf-v5-u-mx-0">
<Tooltip aria="none" aria-live="polite" content={'Notifications'} flipBehavior={['bottom']} className="tooltip-inner-settings-cy">
<NotificationBadge
className="chr-c-notification-badge"
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ const SearchInput = ({ onStateChange }: SearchInputListener) => {
setIsOpen(false);
onStateChange(false);
}}
{...(!md && {
{...{
expandableInput: {
isExpanded: willExpand(),
onToggleExpand,
toggleAriaLabel: 'Expandable search input toggle',
},
})}
}}
onClick={onInputClick}
ref={toggleRef}
onKeyDown={onToggleKeyDown}
Expand Down
Loading