2022-05-13 12:08:49 +00:00
|
|
|
import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures';
|
2019-07-04 22:30:34 +00:00
|
|
|
import ProjectsFilterableList from '~/projects/projects_filterable_list';
|
|
|
|
|
|
|
|
describe('ProjectsFilterableList', () => {
|
|
|
|
let List;
|
|
|
|
let form;
|
|
|
|
let filter;
|
|
|
|
let holder;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
setHTMLFixture(`
|
|
|
|
<form id="project-filter-form">
|
|
|
|
<input name="name" class="js-projects-list-filter" />
|
|
|
|
</div>
|
|
|
|
<div class="js-projects-list-holder"></div>
|
|
|
|
`);
|
|
|
|
form = document.querySelector('form#project-filter-form');
|
|
|
|
filter = document.querySelector('.js-projects-list-filter');
|
|
|
|
holder = document.querySelector('.js-projects-list-holder');
|
|
|
|
List = new ProjectsFilterableList(form, filter, holder);
|
|
|
|
});
|
|
|
|
|
2022-05-13 12:08:49 +00:00
|
|
|
afterEach(() => {
|
|
|
|
resetHTMLFixture();
|
|
|
|
});
|
|
|
|
|
2019-07-04 22:30:34 +00:00
|
|
|
describe('getFilterEndpoint', () => {
|
|
|
|
it('updates converts getPagePath for projects', () => {
|
|
|
|
jest.spyOn(List, 'getPagePath').mockReturnValue('blah/projects?');
|
|
|
|
|
|
|
|
expect(List.getFilterEndpoint()).toEqual('blah/projects.json?');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|