Commit d1e80a82 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Add repo_prev_directory spec and improve a repo_file spec assertion

parent e481cdf5
......@@ -102,6 +102,6 @@ describe('RepoFile', () => {
vm.$el.querySelector('.repo-file-name').click();
expect(vm.linkClicked).toHaveBeenCalled();
expect(vm.linkClicked).toHaveBeenCalledWith(file);
});
});
import Vue from 'vue';
import repoPrevDirectory from '~/repo/repo_prev_directory.vue';
describe('RepoPrevDirectory', () => {
const RepoPrevDirectory = Vue.extend(repoPrevDirectory);
function createComponent(propsData) {
return new RepoPrevDirectory({
propsData,
}).$mount();
}
it('renders a prev dir link', () => {
const prevUrl = 'prevUrl';
const vm = createComponent({
prevUrl,
});
const link = vm.$el.querySelector('a');
spyOn(vm, 'linkClicked');
expect(link).toBeTruthy();
expect(link.href).toMatch(`/${prevUrl}`);
expect(link.textContent).toEqual('..');
link.click();
expect(vm.linkClicked).toHaveBeenCalledWith(prevUrl);
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment