summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerasmus <jerasmus@gitlab.com>2018-10-29 14:25:43 +0200
committerjerasmus <jerasmus@gitlab.com>2018-10-29 14:25:43 +0200
commit3dc5bb6245d5336231078805598adbfdeb331d2d (patch)
tree73087bb640ac0d53e5369ea5929bd9c1ff97cf30
parentc23c0f59b3d022e2700b43c8f23807861ba6bea3 (diff)
downloadgitlab-ce-52122-fix-broken-whitespace-button.tar.gz
Updated unit tests to conform to FE standards.
-rw-r--r--spec/javascripts/diffs/components/compare_versions_spec.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/spec/javascripts/diffs/components/compare_versions_spec.js b/spec/javascripts/diffs/components/compare_versions_spec.js
index 2b6d7cae183..d9d7f61785f 100644
--- a/spec/javascripts/diffs/components/compare_versions_spec.js
+++ b/spec/javascripts/diffs/components/compare_versions_spec.js
@@ -100,20 +100,26 @@ describe('CompareVersions', () => {
});
describe('isWhitespaceVisible', () => {
+ const originalHref = window.location.href;
+
+ afterEach(() => {
+ window.history.replaceState({}, null, originalHref);
+ });
+
it('should return "true" when no "w" flag is present in the URL (default)', () => {
- expect(vm.isWhitespaceVisible()).toBeTruthy();
+ expect(vm.isWhitespaceVisible()).toBe(true);
});
it('should return "false" when the flag is set to "1" in the URL', () => {
window.history.replaceState({}, null, '?w=1');
- expect(vm.isWhitespaceVisible()).toBeFalsy();
+ expect(vm.isWhitespaceVisible()).toBe(false);
});
it('should return "true" when the flag is set to "0" in the URL', () => {
window.history.replaceState({}, null, '?w=0');
- expect(vm.isWhitespaceVisible()).toBeTruthy();
+ expect(vm.isWhitespaceVisible()).toBe(true);
});
});
});