Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
028d1907
Commit
028d1907
authored
Dec 14, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for approvals footer component.
parent
535896cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
spec/javascripts/approvals/approvals_footer_spec.js.es6
spec/javascripts/approvals/approvals_footer_spec.js.es6
+85
-0
No files found.
spec/javascripts/approvals/approvals_footer_spec.js.es6
0 → 100644
View file @
028d1907
//= require vue
//= require underscore
//= require jquery
//= require merge_request_widget/approvals/components/approvals_footer
(() => {
gl.ApprovalsStore = {
data: {},
initStoreOnce() {
return {
then() {},
};
},
};
function initApprovalsFooterComponent() {
fixture.set(`
<div>
<div id="mock-container"></div>
</div>
`);
this.initialData = {
userCanApprove: false,
userHasApproved: true,
approvedBy: [],
approvalsLeft: 1,
pendingAvatarSvg: '<svg></svg>',
checkmarkSvg: '<svg></svg>',
};
const ApprovalsFooterComponent = Vue.component('approvals-footer');
this.approvalsFooter = new ApprovalsFooterComponent({
el: '#mock-container',
propsData: this.initialData,
beforeCreate() {},
});
}
describe('Approvals Footer Component', function () {
beforeEach(function () {
initApprovalsFooterComponent.call(this);
});
it('should correctly set component props', function () {
const approvalsFooter = this.approvalsFooter;
_.each(approvalsFooter, (propValue, propKey) => {
if (this.initialData[propKey]) {
expect(approvalsFooter[propKey]).toBe(this.initialData[propKey]);
}
});
});
describe('Computed properties', function () {
it('should correctly set showUnapproveButton when the user can unapprove', function () {
expect(this.approvalsFooter.showUnapproveButton).toBe(true);
});
it('should correctly set showUnapproveButton when the user can not unapprove', function (done) {
this.approvalsFooter.userCanApprove = true;
Vue.nextTick(() => {
expect(this.approvalsFooter.showUnapproveButton).toBe(false);
done();
});
});
it('should correctly set hasApprovers when there are approvers', function () {
expect(!!this.approvalsFooter.hasApprovers).toBe(false);
});
it('should correctly set hasApprovers when there are no approvers', function (done) {
this.approvalsFooter.approvedBy.push({});
Vue.nextTick(() => {
expect(!!this.approvalsFooter.hasApprovers).toBe(true);
done();
});
});
});
});
})(window.gl || (window.gl = {}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment