Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This PR allows to remove sort field from cross button when only one is applied Closes #831 * SortList test * SorlList snap (cherry picked from commit f446974)
- Loading branch information
1 parent
6c48fc2
commit 36b276b
Showing
3 changed files
with
62 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { mount } from "@vue/test-utils"; | ||
import SortList from "@/components/commons/header/filters/SortList"; | ||
|
||
function mountSortList() { | ||
return mount(SortList, { | ||
propsData: { | ||
sort: [ | ||
{ | ||
disabled: false, | ||
group: "Predictions", | ||
id: "predicted_as", | ||
key: "predicted_as", | ||
name: "Predicted as", | ||
options: Object, | ||
order: "asc", | ||
placeholder: "Select labels", | ||
type: "select", | ||
} | ||
], | ||
sortOptions: [ | ||
{ | ||
disabled: false, | ||
group: "Predictions", | ||
id: "predicted_as", | ||
key: "predicted_as", | ||
name: "Predicted as", | ||
options: Object, | ||
placeholder: "Select labels", | ||
selected: undefined, | ||
type: "select", | ||
} | ||
] | ||
}, | ||
}); | ||
} | ||
|
||
describe("SortList", () => { | ||
let spy = jest.spyOn(console, "error"); | ||
afterEach(() => spy.mockReset()); | ||
|
||
test("renders properly", () => { | ||
const wrapper = mountSortList(); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
frontend/specs/components/filters/__snapshots__/SortList.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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SortList renders properly 1`] = ` | ||
<div> | ||
<sortfilter sort-options="[object Object]" class="sort"></sortfilter> | ||
<!----> | ||
<div class="sort__buttons"> | ||
<re-button class="button-tertiary--small button-tertiary--outline">Cancel</re-button> | ||
<re-button class="button-primary--small">Sort</re-button> | ||
</div> | ||
</div> | ||
`; |