calendar_date_select 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +216 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +39 -0
- data/Rakefile +31 -0
- data/Readme.txt +16 -0
- data/init.rb +1 -0
- data/js_test/functional/cds_test.html +334 -0
- data/js_test/prototype.js +4184 -0
- data/js_test/test.css +40 -0
- data/js_test/unit/cds_helper_methods.html +46 -0
- data/js_test/unittest.js +564 -0
- data/lib/calendar_date_select.rb +19 -0
- data/lib/calendar_date_select/calendar_date_select.rb +223 -0
- data/lib/calendar_date_select/includes_helper.rb +38 -0
- data/public/blank_iframe.html +2 -0
- data/public/images/calendar_date_select/calendar.gif +0 -0
- data/public/javascripts/calendar_date_select/calendar_date_select.js +442 -0
- data/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/public/javascripts/calendar_date_select/format_db.js +27 -0
- data/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
- data/public/javascripts/calendar_date_select/format_finnish.js +32 -0
- data/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
- data/public/javascripts/calendar_date_select/format_iso_date.js +46 -0
- data/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/public/javascripts/calendar_date_select/locale/de.js +10 -0
- data/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/public/javascripts/calendar_date_select/locale/fr.js +10 -0
- data/public/javascripts/calendar_date_select/locale/pl.js +10 -0
- data/public/javascripts/calendar_date_select/locale/pt.js +11 -0
- data/public/javascripts/calendar_date_select/locale/ru.js +10 -0
- data/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/public/stylesheets/calendar_date_select/default.css +135 -0
- data/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/public/stylesheets/calendar_date_select/red.css +135 -0
- data/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/test/functional/calendar_date_select_test.rb +157 -0
- data/test/functional/helper_methods_test.rb +15 -0
- data/test/test_helper.rb +19 -0
- metadata +104 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
.calendar_date_select {
|
2
|
+
border:#777 1px solid;
|
3
|
+
display:block;
|
4
|
+
width:195px;
|
5
|
+
z-index: 1000;
|
6
|
+
background-color:white;
|
7
|
+
}
|
8
|
+
/* this is a fun ie6 hack to get drop downs to stay behind the popup window. This should always be just underneath .calendar_date_select */
|
9
|
+
iframe.ie6_blocker {
|
10
|
+
position: absolute;
|
11
|
+
z-index: 999;
|
12
|
+
}
|
13
|
+
|
14
|
+
.calendar_date_select thead th {
|
15
|
+
color: black !important;
|
16
|
+
font-weight:bold;
|
17
|
+
}
|
18
|
+
|
19
|
+
.calendar_date_select .cds_buttons {
|
20
|
+
text-align:center;
|
21
|
+
padding:5px 0px;
|
22
|
+
}
|
23
|
+
|
24
|
+
.calendar_date_select .cds_footer {
|
25
|
+
padding:3px;
|
26
|
+
font-size:10px;
|
27
|
+
text-align:center;
|
28
|
+
}
|
29
|
+
|
30
|
+
.calendar_date_select table {
|
31
|
+
margin: 0px;
|
32
|
+
padding: 0px;
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
.calendar_date_select .cds_header {
|
37
|
+
text-align:center;
|
38
|
+
}
|
39
|
+
|
40
|
+
.calendar_date_select .cds_header * {
|
41
|
+
border:0px;
|
42
|
+
background-color:white;
|
43
|
+
}
|
44
|
+
|
45
|
+
.calendar_date_select .cds_header span {
|
46
|
+
font-size:15px;
|
47
|
+
color: black;
|
48
|
+
font-weight: bold;
|
49
|
+
}
|
50
|
+
|
51
|
+
.calendar_date_select select { font-size:11px;}
|
52
|
+
|
53
|
+
.calendar_date_select .cds_header a:hover {
|
54
|
+
color: white;
|
55
|
+
}
|
56
|
+
.calendar_date_select .cds_header a {
|
57
|
+
width:22px;
|
58
|
+
height:20px;
|
59
|
+
text-decoration: none;
|
60
|
+
font-size:14px;
|
61
|
+
color:black !important;
|
62
|
+
}
|
63
|
+
|
64
|
+
.calendar_date_select .cds_header a.prev {
|
65
|
+
float:left;
|
66
|
+
}
|
67
|
+
.calendar_date_select .cds_header a.next {
|
68
|
+
float:right;
|
69
|
+
}
|
70
|
+
.calendar_date_select .cds_header a.close {
|
71
|
+
float:right;
|
72
|
+
display:none;
|
73
|
+
}
|
74
|
+
|
75
|
+
.calendar_date_select .cds_header select.month {
|
76
|
+
width:90px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.calendar_date_select .cds_header select.year {
|
80
|
+
width:61px;
|
81
|
+
}
|
82
|
+
|
83
|
+
.calendar_date_select .cds_buttons a {
|
84
|
+
color: black;
|
85
|
+
font-size: 9px;
|
86
|
+
}
|
87
|
+
.calendar_date_select td {
|
88
|
+
font-size:12px;
|
89
|
+
width: 24px;
|
90
|
+
height: 21px;
|
91
|
+
text-align:center;
|
92
|
+
vertical-align: middle;
|
93
|
+
background-color: #fff;
|
94
|
+
}
|
95
|
+
.calendar_date_select td.weekend {
|
96
|
+
}
|
97
|
+
|
98
|
+
.calendar_date_select td div {
|
99
|
+
color: #000;
|
100
|
+
}
|
101
|
+
.calendar_date_select td div.other {
|
102
|
+
color: #ccc;
|
103
|
+
}
|
104
|
+
.calendar_date_select td.selected div {
|
105
|
+
color:white;
|
106
|
+
}
|
107
|
+
|
108
|
+
.calendar_date_select tbody td {
|
109
|
+
}
|
110
|
+
.calendar_date_select td.selected {
|
111
|
+
background-color:#777;
|
112
|
+
}
|
113
|
+
|
114
|
+
.calendar_date_select td:hover {
|
115
|
+
background-color:#ccc;
|
116
|
+
}
|
117
|
+
|
118
|
+
.calendar_date_select td.today {
|
119
|
+
border: 1px dashed #999;
|
120
|
+
}
|
121
|
+
|
122
|
+
.calendar_date_select td.disabled div {
|
123
|
+
color: #e6e6e6;
|
124
|
+
}
|
125
|
+
|
126
|
+
.fieldWithErrors .calendar_date_select {
|
127
|
+
border: 2px solid red;
|
128
|
+
}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
.calendar_date_select {
|
2
|
+
color:white;
|
3
|
+
border:#777 1px solid;
|
4
|
+
display:block;
|
5
|
+
width:195px;
|
6
|
+
z-index: 1000;
|
7
|
+
}
|
8
|
+
/* this is a fun ie6 hack to get drop downs to stay behind the popup window. This should always be just underneath .calendar_date_select */
|
9
|
+
iframe.ie6_blocker {
|
10
|
+
position: absolute;
|
11
|
+
z-index: 999;
|
12
|
+
}
|
13
|
+
|
14
|
+
.calendar_date_select thead th {
|
15
|
+
font-weight:bold;
|
16
|
+
background-color: #E7E8E8;
|
17
|
+
border-bottom:2px solid black;
|
18
|
+
color: black !important;
|
19
|
+
}
|
20
|
+
|
21
|
+
.calendar_date_select .cds_buttons {
|
22
|
+
text-align:center;
|
23
|
+
padding:5px 0px;
|
24
|
+
background-color: #5f0000;
|
25
|
+
}
|
26
|
+
|
27
|
+
.calendar_date_select .cds_footer {
|
28
|
+
background-color: black;
|
29
|
+
padding:3px;
|
30
|
+
text-align:center;
|
31
|
+
}
|
32
|
+
|
33
|
+
.calendar_date_select table {
|
34
|
+
margin: 0px;
|
35
|
+
padding: 0px;
|
36
|
+
}
|
37
|
+
|
38
|
+
|
39
|
+
.calendar_date_select .cds_header {
|
40
|
+
background-color: #ccc;
|
41
|
+
border-bottom: 2px solid #aaa;
|
42
|
+
text-align:center;
|
43
|
+
}
|
44
|
+
|
45
|
+
.calendar_date_select .cds_header span {
|
46
|
+
font-size:15px;
|
47
|
+
color: black;
|
48
|
+
font-weight: bold;
|
49
|
+
}
|
50
|
+
|
51
|
+
.calendar_date_select select { font-size:11px;}
|
52
|
+
|
53
|
+
.calendar_date_select .cds_header a:hover {
|
54
|
+
color: white;
|
55
|
+
}
|
56
|
+
.calendar_date_select .cds_header a {
|
57
|
+
width:22px;
|
58
|
+
height:20px;
|
59
|
+
text-decoration: none;
|
60
|
+
font-size:14px;
|
61
|
+
color:black !important;
|
62
|
+
}
|
63
|
+
|
64
|
+
.calendar_date_select .cds_header a.prev {
|
65
|
+
float:left;
|
66
|
+
}
|
67
|
+
.calendar_date_select .cds_header a.next {
|
68
|
+
float:right;
|
69
|
+
}
|
70
|
+
|
71
|
+
.calendar_date_select .cds_header a.close {
|
72
|
+
float:right;
|
73
|
+
display:none;
|
74
|
+
}
|
75
|
+
|
76
|
+
.calendar_date_select .cds_header select.month {
|
77
|
+
width:90px;
|
78
|
+
}
|
79
|
+
|
80
|
+
.calendar_date_select .cds_header select.year {
|
81
|
+
width:61px;
|
82
|
+
}
|
83
|
+
|
84
|
+
.calendar_date_select .cds_buttons a {
|
85
|
+
color: white;
|
86
|
+
font-size: 9px;
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
.calendar_date_select td {
|
91
|
+
background-color: #660000;
|
92
|
+
font-size:12px;
|
93
|
+
width: 24px;
|
94
|
+
height: 21px;
|
95
|
+
text-align:center;
|
96
|
+
vertical-align: middle;
|
97
|
+
}
|
98
|
+
.calendar_date_select td.weekend {
|
99
|
+
background-color: #5a0000;
|
100
|
+
}
|
101
|
+
|
102
|
+
.calendar_date_select td div {
|
103
|
+
color:#fff;
|
104
|
+
}
|
105
|
+
.calendar_date_select td div.other {
|
106
|
+
color: #93554C;
|
107
|
+
}
|
108
|
+
.calendar_date_select td.selected div {
|
109
|
+
color:black;
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
.calendar_date_select tbody td {
|
114
|
+
border-bottom: 1px solid #550000;
|
115
|
+
}
|
116
|
+
.calendar_date_select tbody td.selected {
|
117
|
+
background-color:white;
|
118
|
+
color:black;
|
119
|
+
}
|
120
|
+
|
121
|
+
.calendar_date_select tbody td:hover {
|
122
|
+
background-color:#ccc;
|
123
|
+
}
|
124
|
+
|
125
|
+
.calendar_date_select tbody td.today {
|
126
|
+
border: 1px dashed red;
|
127
|
+
}
|
128
|
+
|
129
|
+
.calendar_date_select td.disabled div {
|
130
|
+
color: #440000;
|
131
|
+
}
|
132
|
+
|
133
|
+
.fieldWithErrors .calendar_date_select {
|
134
|
+
border: 2px solid red;
|
135
|
+
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
.calendar_date_select {
|
2
|
+
color:white;
|
3
|
+
border:#777 1px solid;
|
4
|
+
display:block;
|
5
|
+
width:195px;
|
6
|
+
z-index: 1000;
|
7
|
+
}
|
8
|
+
/* this is a fun ie6 hack to get drop downs to stay behind the popup window. This should always be just underneath .calendar_date_select */
|
9
|
+
iframe.ie6_blocker {
|
10
|
+
position: absolute;
|
11
|
+
z-index: 999;
|
12
|
+
}
|
13
|
+
|
14
|
+
.calendar_date_select thead th {
|
15
|
+
font-weight:bold;
|
16
|
+
background-color: #000;
|
17
|
+
border-top:1px solid #777;
|
18
|
+
border-bottom:2px solid #333;
|
19
|
+
color: white !important;
|
20
|
+
}
|
21
|
+
|
22
|
+
.calendar_date_select .cds_buttons {
|
23
|
+
text-align:center;
|
24
|
+
padding:5px 0px;
|
25
|
+
background-color: #555;
|
26
|
+
}
|
27
|
+
|
28
|
+
.calendar_date_select .cds_footer {
|
29
|
+
background-color: black;
|
30
|
+
padding:3px;
|
31
|
+
font-size:12px;
|
32
|
+
text-align:center;
|
33
|
+
}
|
34
|
+
|
35
|
+
.calendar_date_select table {
|
36
|
+
margin: 0px;
|
37
|
+
padding: 0px;
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
.calendar_date_select .cds_header {
|
42
|
+
background-color: #ccc;
|
43
|
+
border-bottom: 2px solid #aaa;
|
44
|
+
text-align:center;
|
45
|
+
}
|
46
|
+
|
47
|
+
.calendar_date_select .cds_header span {
|
48
|
+
font-size:15px;
|
49
|
+
color: black;
|
50
|
+
font-weight: bold;
|
51
|
+
}
|
52
|
+
|
53
|
+
.calendar_date_select select { font-size:11px;}
|
54
|
+
|
55
|
+
.calendar_date_select .cds_header a:hover {
|
56
|
+
color: white;
|
57
|
+
}
|
58
|
+
.calendar_date_select .cds_header a {
|
59
|
+
width:22px;
|
60
|
+
height:20px;
|
61
|
+
text-decoration: none;
|
62
|
+
font-size:14px;
|
63
|
+
color:black !important;
|
64
|
+
}
|
65
|
+
|
66
|
+
.calendar_date_select .cds_header a.prev {
|
67
|
+
float:left;
|
68
|
+
}
|
69
|
+
.calendar_date_select .cds_header a.next {
|
70
|
+
float:right;
|
71
|
+
}
|
72
|
+
.calendar_date_select .cds_header a.close {
|
73
|
+
float:right;
|
74
|
+
display:none;
|
75
|
+
}
|
76
|
+
|
77
|
+
.calendar_date_select .cds_header select.month {
|
78
|
+
width:90px;
|
79
|
+
}
|
80
|
+
|
81
|
+
.calendar_date_select .cds_header select.year {
|
82
|
+
width:61px;
|
83
|
+
}
|
84
|
+
|
85
|
+
.calendar_date_select .cds_buttons a {
|
86
|
+
color: white;
|
87
|
+
font-size: 9px;
|
88
|
+
}
|
89
|
+
.calendar_date_select td {
|
90
|
+
font-size:12px;
|
91
|
+
width: 24px;
|
92
|
+
height: 21px;
|
93
|
+
text-align:center;
|
94
|
+
vertical-align: middle;
|
95
|
+
background-color: #666666;
|
96
|
+
}
|
97
|
+
.calendar_date_select td.weekend {
|
98
|
+
background-color: #606060;
|
99
|
+
}
|
100
|
+
|
101
|
+
.calendar_date_select td div {
|
102
|
+
color: #fff;
|
103
|
+
}
|
104
|
+
.calendar_date_select td div.other {
|
105
|
+
color: #888;
|
106
|
+
}
|
107
|
+
.calendar_date_select td.selected div {
|
108
|
+
color:black;
|
109
|
+
}
|
110
|
+
|
111
|
+
.calendar_date_select tbody td {
|
112
|
+
border-bottom: 1px solid #555;
|
113
|
+
}
|
114
|
+
.calendar_date_select td.selected {
|
115
|
+
background-color:white;
|
116
|
+
}
|
117
|
+
|
118
|
+
.calendar_date_select td:hover {
|
119
|
+
background-color:#ccc;
|
120
|
+
}
|
121
|
+
|
122
|
+
.calendar_date_select td.today {
|
123
|
+
border: 1px dashed #999;
|
124
|
+
}
|
125
|
+
|
126
|
+
.calendar_date_select td.disabled div {
|
127
|
+
color: #454545;
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
.fieldWithErrors .calendar_date_select {
|
132
|
+
border: 2px solid red;
|
133
|
+
}
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../test_helper.rb')
|
2
|
+
|
3
|
+
class HelperMethodsTest < Test::Unit::TestCase
|
4
|
+
include ActionView::Helpers::FormHelper
|
5
|
+
include ActionView::Helpers::JavaScriptHelper
|
6
|
+
include ActionView::Helpers::AssetTagHelper
|
7
|
+
include ActionView::Helpers::TagHelper
|
8
|
+
include ActionView::Helpers::FormTagHelper
|
9
|
+
|
10
|
+
include CalendarDateSelect::FormHelper
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@controller = ActionController::Base.new
|
14
|
+
@request = OpenStruct.new
|
15
|
+
@controller.request = @request
|
16
|
+
|
17
|
+
@model = OpenStruct.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_mixed_time__model_returns_date__should_render_without_time
|
21
|
+
@model.start_datetime = Date.parse("January 2, 2007")
|
22
|
+
output = calendar_date_select(:model, :start_datetime, :time => "mixed")
|
23
|
+
assert_no_match(/12:00 AM/, output, "Shouldn't have outputted a time")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_mixed_time__model_returns_time__should_render_with_time
|
27
|
+
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
28
|
+
output = calendar_date_select(:model, :start_datetime, :time => "mixed")
|
29
|
+
assert_match(/12:00 AM/, output, "Should have outputted a time")
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_time_true__model_returns_date__should_render_with_time
|
33
|
+
@model.start_datetime = Date.parse("January 2, 2007")
|
34
|
+
output = calendar_date_select(:model, :start_datetime, :time => "true")
|
35
|
+
assert_match(/12:00 AM/, output, "Should have outputted a time")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_time_false__model_returns_time__should_render_without_time
|
39
|
+
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
40
|
+
output = calendar_date_select(:model, :start_datetime)
|
41
|
+
assert_no_match(/12:00 AM/, output, "Shouldn't have outputted a time")
|
42
|
+
end
|
43
|
+
|
44
|
+
def test__nil_model__shouldnt_populate_value
|
45
|
+
@model = nil
|
46
|
+
output = calendar_date_select(:model, :start_datetime)
|
47
|
+
|
48
|
+
assert_no_match(/value/, output)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test__vdc__should_auto_format_function
|
52
|
+
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
53
|
+
output = calendar_date_select(:model,
|
54
|
+
:start_datetime,
|
55
|
+
:valid_date_check => "date < new Date()"
|
56
|
+
)
|
57
|
+
assert_match("valid_date_check:function(date) { return(date < new Date()) }", output)
|
58
|
+
|
59
|
+
output = calendar_date_select(:model,
|
60
|
+
:start_datetime,
|
61
|
+
:valid_date_check => "return(date < new Date())"
|
62
|
+
)
|
63
|
+
assert_match("valid_date_check:function(date) { return(date < new Date()) }", output)
|
64
|
+
output = calendar_date_select(:model,
|
65
|
+
:start_datetime,
|
66
|
+
:valid_date_check => "function(p) { return(date < new Date()) }"
|
67
|
+
)
|
68
|
+
assert_match("valid_date_check:function(p) { return(date < new Date()) }", output)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test__vdc__excluded_return__should_raise_error
|
72
|
+
throw_message = ":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'"
|
73
|
+
assert_throws throw_message.to_sym do
|
74
|
+
output = calendar_date_select(:model,
|
75
|
+
:start_datetime,
|
76
|
+
:valid_date_check => "date = 5; date < new Date());"
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
assert_throws throw_message.to_sym do
|
81
|
+
output = calendar_date_select(:model,
|
82
|
+
:start_datetime,
|
83
|
+
:valid_date_check => "function(p) { date = 5; date < new Date()); }"
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test__year_range__formats_correctly
|
89
|
+
output = calendar_date_select(:model, :start_datetime)
|
90
|
+
assert_match("year_range:10", output)
|
91
|
+
output = calendar_date_select(:model, :start_datetime, :year_range => 2000..2010)
|
92
|
+
assert_match("year_range:[2000, 2010]", output)
|
93
|
+
output = calendar_date_select(:model, :start_datetime, :year_range => (15.years.ago..5.years.ago))
|
94
|
+
assert_match("year_range:[#{15.years.ago.year}, #{5.years.ago.year}]", output)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test__tag__formats_text_correctly_string
|
98
|
+
time = "January 2, 2007 12:01:23 AM"
|
99
|
+
output = calendar_date_select_tag(:name, time)
|
100
|
+
|
101
|
+
assert_match(time, output, "Should have outputted a correctly formatted time")
|
102
|
+
end
|
103
|
+
|
104
|
+
def test__tag__formats_text_correctly_date
|
105
|
+
time = Date.new(2007, 01, 02)
|
106
|
+
output = calendar_date_select_tag(:name, time)
|
107
|
+
|
108
|
+
assert_no_match(/12:01 AM/, output, "Should not have outputted a time")
|
109
|
+
assert_match(CalendarDateSelect.format_date(time), output, "Should have outputted a correctly formatted time")
|
110
|
+
end
|
111
|
+
|
112
|
+
def test__tag__formats_text_correctly_time
|
113
|
+
time = Time.parse("January 2, 2007 12:01:23 AM")
|
114
|
+
output = calendar_date_select_tag(:name, time)
|
115
|
+
|
116
|
+
assert_match(CalendarDateSelect.format_date(time), output, "Should have outputted a correctly formatted time")
|
117
|
+
end
|
118
|
+
|
119
|
+
def test__tag__formats_text_correctly_with_time_option
|
120
|
+
time = Time.parse("January 2, 2007 12:01:23 AM")
|
121
|
+
output = calendar_date_select_tag(:name, time, :time => true)
|
122
|
+
|
123
|
+
assert_match(CalendarDateSelect.format_date(time), output, "Should have outputted a correctly formatted time")
|
124
|
+
end
|
125
|
+
|
126
|
+
def test__tag__formats_text_correctly_with_mixed_option
|
127
|
+
time = Time.parse("January 2, 2007 12:01:23 AM")
|
128
|
+
output = calendar_date_select_tag(:name, time, :time => 'mixed')
|
129
|
+
|
130
|
+
assert_match(CalendarDateSelect.format_date(time), output, "Should have outputted a correctly formatted time")
|
131
|
+
end
|
132
|
+
|
133
|
+
def test__tag__formats_text_correctly_time_as_date
|
134
|
+
time = Time.parse("January 2, 2007 12:01:23 AM")
|
135
|
+
output = calendar_date_select_tag(:name, time, :time => false)
|
136
|
+
|
137
|
+
assert_no_match(/12:01 AM/, output, "Should not have outputted a time")
|
138
|
+
assert_match(time.strftime(CalendarDateSelect.date_format_string(false)), output, "Should have outputted a correctly formatted time")
|
139
|
+
end
|
140
|
+
|
141
|
+
def test__tag__formats_text_correctly_time_with_format
|
142
|
+
time = Time.parse("January 2, 2007 12:01:00 AM")
|
143
|
+
output = calendar_date_select_tag(:name, time, :format => "%Y-%m-%d")
|
144
|
+
|
145
|
+
assert_no_match(/12:01 AM/, output, "Should not have outputted a time")
|
146
|
+
assert_match('2007-01-02', output, "Should have outputted a correctly formatted time")
|
147
|
+
end
|
148
|
+
|
149
|
+
def test__nil_object_option__should_disregard
|
150
|
+
@model.start_datetime = Time.parse("January 2, 2007 12:00 AM")
|
151
|
+
output = calendar_date_select(:model, :start_datetime, :time => true, :object => nil)
|
152
|
+
assert_match(CalendarDateSelect.format_date(@model.start_datetime), output, "Should have outputted a time")
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
|