summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-06-08 09:29:57 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-06-08 09:29:57 +0100
commit3004a05c884279fd0cd4982282947d55bfbb2ce0 (patch)
tree7a41c5ce3456ea1070c74b0702583a7675220a3b /spec/javascripts
parent718d919012ec3aa4cedb127a253cce8de4a8e918 (diff)
parentacdd1bf7c92b7e9cdbd579df8faca5ea7783489f (diff)
downloadgitlab-ce-33210-stop-auto-scroll.tar.gz
Merge branch 'master' into 33210-stop-auto-scroll33210-stop-auto-scroll
* master: (92 commits) Responsive table fixes remove the rouge copypasta and add notes to refactor nil-check Repository::is_ancestor? update rouge to 2.1.0 Added more negative checks for public project Fix End Syntax Error Enhancing Spec's with negative cases Improve form spec Update CHANGELOG.md for 9.0.10 Update CHANGELOG.md for 9.2.5 Fixed spec test syntax errors Update CHANGELOG.md for 9.1.7 Translate project & repository pages Converting Tests to Spec Tests Added more actions and report as abuse to all notes Add sticky confidential issue bar Fix for Login Test Problem Document not using STI Added Cop to blacklist polymorphic associations Document not using polymorphic associations ...
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/build_spec.js2
-rw-r--r--spec/javascripts/datetime_utility_spec.js20
2 files changed, 21 insertions, 1 deletions
diff --git a/spec/javascripts/build_spec.js b/spec/javascripts/build_spec.js
index 461908f3fde..4c8a48580d7 100644
--- a/spec/javascripts/build_spec.js
+++ b/spec/javascripts/build_spec.js
@@ -58,7 +58,7 @@ describe('Build', () => {
it('displays the remove date correctly', () => {
const removeDateElement = document.querySelector('.js-artifacts-remove');
- expect(removeDateElement.innerText.trim()).toBe('1 year');
+ expect(removeDateElement.innerText.trim()).toBe('1 year remaining');
});
});
diff --git a/spec/javascripts/datetime_utility_spec.js b/spec/javascripts/datetime_utility_spec.js
index e347c980c78..c82ad0bea48 100644
--- a/spec/javascripts/datetime_utility_spec.js
+++ b/spec/javascripts/datetime_utility_spec.js
@@ -2,6 +2,26 @@ import '~/lib/utils/datetime_utility';
(() => {
describe('Date time utils', () => {
+ describe('timeFor', () => {
+ it('returns `past due` when in past', () => {
+ const date = new Date();
+ date.setFullYear(date.getFullYear() - 1);
+
+ expect(
+ gl.utils.timeFor(date),
+ ).toBe('Past due');
+ });
+
+ it('returns remaining time when in the future', () => {
+ const date = new Date();
+ date.setFullYear(date.getFullYear() + 1);
+
+ expect(
+ gl.utils.timeFor(date),
+ ).toBe('1 year remaining');
+ });
+ });
+
describe('get day name', () => {
it('should return Sunday', () => {
const day = gl.utils.getDayName(new Date('07/17/2016'));