Copy datepicker directive to utils module

Ensures that datepicker is available for subscriptions
This commit is contained in:
Rob Harrington
2018-03-21 12:25:03 +11:00
committed by Maikel Linke
parent 386716088a
commit c77a01815c
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
angular.module("admin.utils").directive "datepicker", ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
element.datepicker
dateFormat: "yy-mm-dd"
onSelect: (dateText, inst) ->
scope.$apply (scope) ->
# Fires ngModel.$parsers
ngModel.$setViewValue dateText

View File

@@ -159,7 +159,10 @@ feature 'Subscriptions' do
click_button('Next')
expect(page).to have_content 'can\'t be blank', count: 2
expect(page).to have_content 'Oops! Please fill in all of the required fields...'
fill_in 'begins_at', with: Time.zone.today.strftime('%F')
find_field('begins_at').click
within(".ui-datepicker-calendar") do
find('.ui-datepicker-today').click
end
select2_select card2_option, from: 'credit_card_id'
click_button('Next')