Commit 8df33720 authored by Phil Hughes's avatar Phil Hughes

Fixed JS tests

parent a2ec4c67
/* eslint-disable no-unused-vars */
class ListAssignee {
constructor(user) {
constructor(user, defaultAvatar) {
this.id = user.id;
this.name = user.name;
this.username = user.username;
this.avatar = user.avatar_url;
this.avatar = user.avatar_url || defaultAvatar;
}
}
......
......@@ -237,75 +237,6 @@ describe('Issue card component', () => {
});
});
describe('multiple assignees', () => {
beforeEach((done) => {
component.issue.assignees = [
user,
new ListAssignee({
id: 2,
name: 'user2',
username: 'user2',
avatar: 'test_image',
}),
new ListAssignee({
id: 3,
name: 'user3',
username: 'user3',
avatar: 'test_image',
}),
new ListAssignee({
id: 4,
name: 'user4',
username: 'user4',
avatar: 'test_image',
})];
Vue.nextTick(() => done());
});
it('renders all four assignees', () => {
expect(component.$el.querySelectorAll('.card-assignee .avatar').length).toEqual(4);
});
describe('more than four assignees', () => {
beforeEach((done) => {
component.issue.assignees.push(new ListAssignee({
id: 5,
name: 'user5',
username: 'user5',
avatar: 'test_image',
}));
Vue.nextTick(() => done());
});
it('renders more avatar counter', () => {
expect(component.$el.querySelector('.card-assignee .avatar-counter').innerText).toEqual('+2');
});
it('renders three assignees', () => {
expect(component.$el.querySelectorAll('.card-assignee .avatar').length).toEqual(3);
});
it('renders 99+ avatar counter', (done) => {
for (let i = 5; i < 104; i += 1) {
const u = new ListAssignee({
id: i,
name: 'name',
username: 'username',
avatar: 'test_image',
});
component.issue.assignees.push(u);
}
Vue.nextTick(() => {
expect(component.$el.querySelector('.card-assignee .avatar-counter').innerText).toEqual('99+');
done();
});
});
});
});
describe('labels', () => {
it('does not render any', () => {
expect(
......
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