forked from tektoncd/hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI:Adds search and sort implementation
Signed-off-by: Shiv Verma <[email protected]>
- Loading branch information
1 parent
c44c2bd
commit 5d17a69
Showing
16 changed files
with
319 additions
and
209 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import { mount } from 'enzyme'; | ||
import { FakeHub } from '../../api/testutil'; | ||
import { createProviderAndStore } from '../../store/root'; | ||
import Header from '.'; | ||
import Search from '../../containers/Search'; | ||
|
||
it('should render the header component', () => { | ||
const component = renderer.create(<Header />).toJSON(); | ||
expect(component).toMatchSnapshot(); | ||
const TESTDATA_DIR = `src/store/testdata`; | ||
const api = new FakeHub(TESTDATA_DIR); | ||
const { Provider } = createProviderAndStore(api); | ||
|
||
it('should render the header component and finds Search component', () => { | ||
const component = mount( | ||
<Provider> | ||
<Header /> | ||
</Provider> | ||
); | ||
|
||
expect(component.find(Search).length).toBe(1); | ||
expect(component.debug()).toMatchSnapshot(); | ||
}); |
94 changes: 42 additions & 52 deletions
94
ui/src/components/Header/__snapshots__/Header.test.tsx.snap
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 |
---|---|---|
@@ -1,55 +1,45 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`should render the header component 1`] = ` | ||
<header | ||
className="pf-c-page__header" | ||
> | ||
<div | ||
className="pf-c-page__header-brand" | ||
> | ||
<a | ||
className="pf-c-page__header-brand-link" | ||
> | ||
<img | ||
alt="Tekton Hub Logo" | ||
className="pf-c-brand" | ||
onClick={[Function]} | ||
src="logo.png" | ||
/> | ||
</a> | ||
</div> | ||
<div | ||
className="pf-c-page__header-tools" | ||
> | ||
<div | ||
className="pf-l-grid" | ||
> | ||
<div | ||
className="pf-l-grid__item pf-m-11-col" | ||
> | ||
<input | ||
aria-invalid={false} | ||
aria-label="text input example" | ||
className="pf-c-form-control hub-search" | ||
disabled={false} | ||
onBlur={[Function]} | ||
onChange={[Function]} | ||
onFocus={[Function]} | ||
placeholder="Search for resources..." | ||
readOnly={false} | ||
required={false} | ||
spellCheck="false" | ||
type="search" | ||
value="" | ||
/> | ||
</div> | ||
</div> | ||
<h3 | ||
className="" | ||
data-pf-content={true} | ||
> | ||
Login | ||
</h3> | ||
</div> | ||
</header> | ||
exports[`should render the header component and finds Search component 1`] = ` | ||
"<Provider> | ||
<Header> | ||
<PageHeader logo={{...}} headerTools={{...}}> | ||
<header role={[undefined]} className=\\"pf-c-page__header\\"> | ||
<div className=\\"pf-c-page__header-brand\\"> | ||
<a className=\\"pf-c-page__header-brand-link\\"> | ||
<Brand src=\\"logo.png\\" alt=\\"Tekton Hub Logo\\" onClick={[Function: onClick]}> | ||
<img onClick={[Function: onClick]} className=\\"pf-c-brand\\" src=\\"logo.png\\" alt=\\"Tekton Hub Logo\\" /> | ||
</Brand> | ||
</a> | ||
</div> | ||
<PageHeaderTools> | ||
<div className=\\"pf-c-page__header-tools\\"> | ||
<Grid> | ||
<div className=\\"pf-l-grid\\"> | ||
<GridItem span={11}> | ||
<div className=\\"pf-l-grid__item pf-m-11-col\\"> | ||
<Search> | ||
<ForwardRef value=\\"\\" type=\\"search\\" onChange={[Function: onSearchChange]} onKeyPress={[Function: onSearchKeyPress]} aria-label=\\"text input example\\" placeholder=\\"Search for resources...\\" spellCheck=\\"false\\" className=\\"hub-search\\"> | ||
<TextInputBase value=\\"\\" type=\\"search\\" onChange={[Function: onSearchChange]} onKeyPress={[Function: onSearchKeyPress]} aria-label=\\"text input example\\" placeholder=\\"Search for resources...\\" spellCheck=\\"false\\" className=\\"hub-search\\" innerRef={{...}} isRequired={false} validated=\\"default\\" isDisabled={false} isReadOnly={false} isLeftTruncated={false}> | ||
<input onKeyPress={[Function: onSearchKeyPress]} aria-label=\\"text input example\\" placeholder=\\"Search for resources...\\" spellCheck=\\"false\\" onFocus={[Function (anonymous)]} onBlur={[Function (anonymous)]} className=\\"pf-c-form-control hub-search\\" onChange={[Function (anonymous)]} type=\\"search\\" value=\\"\\" aria-invalid={false} required={false} disabled={false} readOnly={false} /> | ||
</TextInputBase> | ||
</ForwardRef> | ||
</Search> | ||
</div> | ||
</GridItem> | ||
</div> | ||
</Grid> | ||
<Text component=\\"h3\\"> | ||
<h3 data-pf-content={true} className=\\"\\"> | ||
Login | ||
</h3> | ||
</Text> | ||
</div> | ||
</PageHeaderTools> | ||
</header> | ||
</PageHeader> | ||
</Header> | ||
</Provider>" | ||
`; |
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
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
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
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
Oops, something went wrong.