This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize classes, align label with filter tags, fix filtertag tests
- Loading branch information
1 parent
62b8d8e
commit 107526c
Showing
5 changed files
with
59 additions
and
30 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
22 changes: 22 additions & 0 deletions
22
test/unit/specs/components/__snapshots__/filter-tag.spec.js.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`FilterTag should render correct contents 1`] = ` | ||
<div | ||
aria-label="filters.filter-tag-aria" | ||
class="button tiny tag" | ||
> | ||
<span> | ||
bar-foo | ||
</span> | ||
<span | ||
class="close ml-2 p-2" | ||
role="button" | ||
tabindex="0" | ||
> | ||
<i | ||
class="icon cross" | ||
/> | ||
</span> | ||
</div> | ||
`; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import FilterTag from '~/components/Filters/FilterTag' | ||
import { render, screen } from '@testing-library/vue' | ||
import userEvent from '@testing-library/user-event' | ||
|
||
describe('FilterTag', () => { | ||
let options = {} | ||
let props = null | ||
beforeEach(() => { | ||
props = { | ||
code: 'foo', | ||
label: 'bar-foo', | ||
filterType: 'bar', | ||
} | ||
options = { propsData: props, listeners: { filterChanged: jest.fn() } } | ||
}) | ||
|
||
it('should render correct contents', () => { | ||
const { container } = render(FilterTag, options) | ||
expect(container.firstChild).toMatchSnapshot() | ||
}) | ||
|
||
it('should emit filterChanged event', () => { | ||
render(FilterTag, options) | ||
userEvent.click(screen.getByRole('button')) | ||
expect(options.listeners.filterChanged).toHaveBeenCalledWith({ | ||
code: 'foo', | ||
filterType: 'bar', | ||
}) | ||
}) | ||
}) |