Commit 12cc9a53 authored by Phil Hughes's avatar Phil Hughes

Changed date check test

parent 5942247d
...@@ -34,7 +34,7 @@ require('bootstrap/js/transition'); ...@@ -34,7 +34,7 @@ require('bootstrap/js/transition');
require('bootstrap/js/tooltip'); require('bootstrap/js/tooltip');
require('bootstrap/js/popover'); require('bootstrap/js/popover');
require('select2/select2.js'); require('select2/select2.js');
require('pikaday'); window.Pikaday = require('pikaday');
window._ = require('underscore'); window._ = require('underscore');
window.Dropzone = require('dropzone'); window.Dropzone = require('dropzone');
require('mousetrap'); require('mousetrap');
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
const calendar = new Pikaday({ const calendar = new Pikaday({
field: $dueDateInput.get(0), field: $dueDateInput.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
format: 'yyyy-mm-dd', format: 'YYYY-MM-DD',
onSelect: (dateText) => { onSelect: (dateText) => {
const formattedDate = dateFormat(new Date(dateText), 'yyyy-mm-dd'); const formattedDate = dateFormat(new Date(dateText), 'yyyy-mm-dd');
...@@ -63,8 +63,6 @@ ...@@ -63,8 +63,6 @@
} }
}); });
calendar.setDate(new Date($dueDateInput.val()));
this.$datePicker.append(calendar.el); this.$datePicker.append(calendar.el);
this.$datePicker.data('pikaday', calendar); this.$datePicker.data('pikaday', calendar);
} }
...@@ -171,12 +169,11 @@ ...@@ -171,12 +169,11 @@
const calendar = new Pikaday({ const calendar = new Pikaday({
field: $datePicker.get(0), field: $datePicker.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
format: 'yyyy-mm-dd', format: 'YYYY-MM-DD',
onSelect(dateText) { onSelect(dateText) {
$datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); $datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
} }
}); });
calendar.setDate(new Date($datePicker.val()));
$datePicker.data('pikaday', calendar); $datePicker.data('pikaday', calendar);
}); });
......
...@@ -40,12 +40,11 @@ ...@@ -40,12 +40,11 @@
calendar = new Pikaday({ calendar = new Pikaday({
field: $issuableDueDate.get(0), field: $issuableDueDate.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
format: 'yyyy-mm-dd', format: 'YYYY-MM-DD',
onSelect: function(dateText) { onSelect: function(dateText) {
$issuableDueDate.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); $issuableDueDate.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
} }
}); });
calendar.setDate(new Date($issuableDueDate.val()));
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
const calendar = new Pikaday({ const calendar = new Pikaday({
field: $input.get(0), field: $input.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
format: 'yyyy-mm-dd', format: 'YYYY-MM-DD',
minDate: new Date(), minDate: new Date(),
onSelect(dateText) { onSelect(dateText) {
$input.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); $input.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
}, },
}); });
calendar.setDate(new Date($input.val()));
$input.data('pikaday', calendar); $input.data('pikaday', calendar);
}); });
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
new Pikaday({ new Pikaday({
field: $dateField.get(0), field: $dateField.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
format: 'yyyy-mm-dd', format: 'YYYY-MM-DD',
minDate: new Date(), minDate: new Date(),
onSelect: function(dateText) { onSelect: function(dateText) {
$dateField.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); $dateField.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
......
...@@ -15,29 +15,33 @@ feature 'Projects > Members > Master adds member with expiration date', feature: ...@@ -15,29 +15,33 @@ feature 'Projects > Members > Master adds member with expiration date', feature:
end end
scenario 'expiration date is displayed in the members list' do scenario 'expiration date is displayed in the members list' do
date = 5.days.from_now travel_to Time.zone.parse('2016-08-06 08:00') do
visit namespace_project_project_members_path(project.namespace, project) date = 4.days.from_now
visit namespace_project_project_members_path(project.namespace, project)
page.within '.users-project-form' do
select2(new_member.id, from: '#user_ids', multiple: true) page.within '.users-project-form' do
fill_in 'expires_at', with: date.to_s(:medium) select2(new_member.id, from: '#user_ids', multiple: true)
click_on 'Add to project' fill_in 'expires_at', with: date.to_s(:medium)
end click_on 'Add to project'
end
page.within "#project_member_#{new_member.project_members.first.id}" do
expect(page).to have_content('Expires in 4 days') page.within "#project_member_#{new_member.project_members.first.id}" do
expect(page).to have_content('Expires in 4 days')
end
end end
end end
scenario 'change expiration date' do scenario 'change expiration date' do
date = 4.days.from_now travel_to Time.zone.parse('2016-08-06 08:00') do
project.team.add_users([new_member.id], :developer, expires_at: Date.today.to_s(:medium)) date = 3.days.from_now
visit namespace_project_project_members_path(project.namespace, project) project.team.add_users([new_member.id], :developer, expires_at: Date.today.to_s(:medium))
visit namespace_project_project_members_path(project.namespace, project)
page.within "#project_member_#{new_member.project_members.first.id}" do
find('.js-access-expiration-date').set date.to_s(:medium) page.within "#project_member_#{new_member.project_members.first.id}" do
wait_for_ajax find('.js-access-expiration-date').set date.to_s(:medium)
expect(page).to have_content('Expires in 3 days') wait_for_ajax
expect(page).to have_content('Expires in 3 days')
end
end end
end end
end end
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