semantic_date_time_tags 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4800b3e699623bb9b5f17a93493d6b500102d375
|
4
|
+
data.tar.gz: 077d95c97fe7ec45e0f8e8df97c903de2345ee65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86200f3d4f3b6449bc092085f56c32b5867be100a2f8bb83e455dc72457eb10d1a887b48cc0c44c4286f7ffdeca0f8af2525e0a836d3d61dc9bad978d44678f1
|
7
|
+
data.tar.gz: 4c7a9258200b0a438011ab77bf452fac8f2df7a311b316779ad0da16065578a7721ed4fdbffe846ae254c7314b0d728d05cdb3bcb833bf1241cb4a9e20bc95b9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
semantic_date_time_tags (0.1.
|
4
|
+
semantic_date_time_tags (0.1.9)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -83,8 +83,8 @@ GEM
|
|
83
83
|
loofah (2.0.3)
|
84
84
|
nokogiri (>= 1.5.9)
|
85
85
|
lumberjack (1.0.9)
|
86
|
-
mail (2.6.
|
87
|
-
mime-types (>= 1.16, <
|
86
|
+
mail (2.6.4)
|
87
|
+
mime-types (>= 1.16, < 4)
|
88
88
|
method_source (0.8.2)
|
89
89
|
mime-types (2.6.2)
|
90
90
|
mini_portile2 (2.0.0)
|
@@ -142,7 +142,7 @@ GEM
|
|
142
142
|
simplecov-html (~> 0.10.0)
|
143
143
|
simplecov-html (0.10.0)
|
144
144
|
slop (3.6.0)
|
145
|
-
sprockets (3.
|
145
|
+
sprockets (3.6.0)
|
146
146
|
concurrent-ruby (~> 1.0)
|
147
147
|
rack (> 1, < 3)
|
148
148
|
sprockets-rails (3.0.4)
|
@@ -85,11 +85,15 @@ module SemanticDateTimeTags
|
|
85
85
|
# ---------------------------------------------------------------------
|
86
86
|
|
87
87
|
def dom_data
|
88
|
-
{ in_words: in_words }
|
88
|
+
{ in_words: in_words, format: format.to_s }
|
89
89
|
end
|
90
90
|
|
91
91
|
private # =============================================================
|
92
92
|
|
93
|
+
def scope
|
94
|
+
raise NotImplementedError
|
95
|
+
end
|
96
|
+
|
93
97
|
def format_string
|
94
98
|
I18n.t(scope)[format]
|
95
99
|
end
|
@@ -25,55 +25,56 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'returns hours wrapped in a span tag' do
|
28
|
-
semantic_time_tag(time_object).must_match
|
28
|
+
semantic_time_tag(time_object).must_match(Regexp.new("<span.+?hours.+?H.+?>#{time_object_hours}</span>"))
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'returns minutes wrapped in a span tag' do
|
32
|
-
semantic_time_tag(time_object).must_match
|
32
|
+
semantic_time_tag(time_object).must_match(Regexp.new("<span.+?minutes.+?M.+?>#{time_object_minutes}</span>"))
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'wraps the whole thing in a time tag by default' do
|
36
|
-
semantic_time_tag(time_object).must_match
|
36
|
+
semantic_time_tag(time_object).must_match(/\A<time.+?<\/time>\z/)
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'wraps the whole thing in a span tag if passed as argument' do
|
40
|
-
semantic_time_tag(time_object, tag_name: :span).must_match
|
40
|
+
semantic_time_tag(time_object, tag_name: :span).must_match(/\A<span.+?<\/span>\z/)
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'adds whole_hour class if time is whole hour' do
|
44
|
-
semantic_time_tag(time_object_whole_hour).must_match
|
44
|
+
semantic_time_tag(time_object_whole_hour).must_match(/\A<time.+?whole_hour.+?<\/time>\z/)
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'adds whole_minute class if time is whole minute' do
|
48
|
-
semantic_time_tag(time_object_whole_minute).must_match
|
48
|
+
semantic_time_tag(time_object_whole_minute).must_match(/\A<time.+?whole_minute.+?<\/time>\z/)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'adds noon class if time is noon' do
|
52
|
-
semantic_time_tag(time_object_noon).must_match
|
52
|
+
semantic_time_tag(time_object_noon).must_match(/\A<time.+?noon.+?<\/time>\z/)
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'adds midnight class if time is midnight' do
|
56
|
-
semantic_time_tag(time_object_midnight).must_match
|
56
|
+
semantic_time_tag(time_object_midnight).must_match(/\A<time.+?midnight.+?<\/time>\z/)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'adds am class if time is before noon' do
|
60
|
-
semantic_time_tag(time_object_before_noon).must_match
|
60
|
+
semantic_time_tag(time_object_before_noon).must_match(/\A<time.+?am.+?<\/time>\z/)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'adds pm class if time is after noon' do
|
64
|
-
semantic_time_tag(time_object_after_noon).must_match
|
64
|
+
semantic_time_tag(time_object_after_noon).must_match(/\A<time.+?pm.+?<\/time>\z/)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'adds noon as data-in-words if time is noon' do
|
68
|
-
semantic_time_tag(time_object_noon).must_match
|
68
|
+
semantic_time_tag(time_object_noon).must_match(/\A<time.+?data-in-words=\"noon\".+?<\/time>\z/)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'adds midnight as data-in-words if time is midnight' do
|
72
|
-
semantic_time_tag(time_object_midnight).must_match
|
72
|
+
semantic_time_tag(time_object_midnight).must_match(/\A<time.+?data-in-words=\"midnight\".+?<\/time>\z/)
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'allows to pass :format' do
|
76
76
|
semantic_time_tag(time_object, format: :test).must_include '~'
|
77
|
+
semantic_time_tag(time_object, format: :test).must_include 'data-format="test"'
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
@@ -89,17 +90,17 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
89
90
|
end
|
90
91
|
|
91
92
|
it 'wraps everything in a time tag by default' do
|
92
|
-
semantic_date_tag(date_object).must_match
|
93
|
+
semantic_date_tag(date_object).must_match(/\A<time.+?<\/time>\z/)
|
93
94
|
end
|
94
95
|
|
95
96
|
it 'wraps everything in a span tag if passed as argument' do
|
96
|
-
semantic_date_tag(date_object, tag_name: :span).must_match
|
97
|
+
semantic_date_tag(date_object, tag_name: :span).must_match(/\A<span.+?<\/span>\z/)
|
97
98
|
end
|
98
99
|
|
99
100
|
it 'returns year, month and day wrapped in a span tags' do
|
100
|
-
semantic_date_tag(date_object).must_match
|
101
|
-
semantic_date_tag(date_object).must_match
|
102
|
-
semantic_date_tag(date_object).must_match
|
101
|
+
semantic_date_tag(date_object).must_match(Regexp.new("<span.+?year.+?>#{date_object_year}</span>"))
|
102
|
+
semantic_date_tag(date_object).must_match(Regexp.new("<span.+?month.+?>#{date_object_month}</span>"))
|
103
|
+
semantic_date_tag(date_object).must_match(Regexp.new("<span.+?day.+?>#{date_object_day}</span>"))
|
103
104
|
end
|
104
105
|
|
105
106
|
it 'adds current_date class if date is today' do
|
@@ -114,6 +115,7 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
114
115
|
|
115
116
|
it 'allows to pass :format' do
|
116
117
|
semantic_date_tag(Date.today, format: :test).must_include '~'
|
118
|
+
semantic_time_tag(time_object, format: :test).must_include 'data-format="test"'
|
117
119
|
end
|
118
120
|
end
|
119
121
|
|
@@ -129,19 +131,20 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
129
131
|
end
|
130
132
|
|
131
133
|
it 'wraps the whole thing in a time tag' do
|
132
|
-
semantic_date_time_tag(date_time_object).must_match
|
134
|
+
semantic_date_time_tag(date_time_object).must_match(/\A<time.+?<\/time>\z/)
|
133
135
|
end
|
134
136
|
|
135
137
|
it 'adds noon as data-in-words if time is noon' do
|
136
|
-
semantic_date_time_tag(date_time_object_noon).must_match
|
138
|
+
semantic_date_time_tag(date_time_object_noon).must_match(/\A<time.+?data-in-words=\"noon\".+?<\/time>\z/)
|
137
139
|
end
|
138
140
|
|
139
141
|
it 'adds midnight as data-in-words if time is midnight' do
|
140
|
-
semantic_date_time_tag(date_time_object_midnight).must_match
|
142
|
+
semantic_date_time_tag(date_time_object_midnight).must_match(/\A<time.+?data-in-words=\"midnight\".+?<\/time>\z/)
|
141
143
|
end
|
142
144
|
|
143
145
|
it 'allows to pass :format' do
|
144
146
|
semantic_date_time_tag(date_time_object, format: :test).must_include '~'
|
147
|
+
semantic_time_tag(time_object, format: :test).must_include 'data-format="test"'
|
145
148
|
end
|
146
149
|
end
|
147
150
|
|
@@ -155,38 +158,39 @@ describe SemanticDateTimeTags::ViewHelpers do
|
|
155
158
|
let(:date_time_object_to_afternoon) { DateTime.parse("14/11/#{Date.today.year} 15:00") }
|
156
159
|
|
157
160
|
it 'returns the from date wrapped correctly' do
|
158
|
-
semantic_date_range_tag(date_object, date_tomorrow_object).must_match
|
161
|
+
semantic_date_range_tag(date_object, date_tomorrow_object).must_match(/<time.+?semantic.+?date.+?from.+?>.+?<time.+?semantic.+?date.+?to.+?>/)
|
159
162
|
end
|
160
163
|
|
161
164
|
it 'adds same_year and current_year class to wrapping span' do
|
162
|
-
semantic_date_range_tag(date_object, date_tomorrow_object).must_match
|
165
|
+
semantic_date_range_tag(date_object, date_tomorrow_object).must_match(/\A<span.+?date_range.+?current_year.+?>/)
|
163
166
|
end
|
164
167
|
|
165
168
|
it 'adds same_day to wrapping span' do
|
166
|
-
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match
|
169
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match(/\A<span.+?date_range.+?same_day.+?>/)
|
167
170
|
end
|
168
171
|
|
169
172
|
it 'adds same_time to wrapping span' do
|
170
|
-
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match
|
173
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_from).must_match(/\A<span.+?date_range.+?same_day.+?same_time.+?>/)
|
171
174
|
end
|
172
175
|
|
173
176
|
it 'adds am to wrapping span if both times in morning' do
|
174
|
-
semantic_date_range_tag(date_time_object_from_morning - 1.hour, date_time_object_from_morning).must_match
|
175
|
-
semantic_date_range_tag(date_time_object_from_morning, date_time_object_to_afternoon).wont_match
|
176
|
-
semantic_date_range_tag(date_time_object_to_afternoon, date_time_object_to_afternoon + 1.hour).must_match
|
177
|
+
semantic_date_range_tag(date_time_object_from_morning - 1.hour, date_time_object_from_morning).must_match(/\A<span.+?date_range.+?same_meridian.+?>/)
|
178
|
+
semantic_date_range_tag(date_time_object_from_morning, date_time_object_to_afternoon).wont_match(/\A<span.+?date_range.+?same_meridian.+?>/)
|
179
|
+
semantic_date_range_tag(date_time_object_to_afternoon, date_time_object_to_afternoon + 1.hour).must_match(/\A<span.+?date_range.+?same_meridian.+?>/)
|
177
180
|
end
|
178
181
|
|
179
182
|
it 'accepts datetime objects' do
|
180
|
-
semantic_date_range_tag(date_time_object_from, date_time_object_to).must_match
|
181
|
-
semantic_date_range_tag(date_time_object_from, date_time_object_to).must_match
|
183
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_to).must_match(/<time.+?from.+?<\/time>/)
|
184
|
+
semantic_date_range_tag(date_time_object_from, date_time_object_to).must_match(/<time.+?to.+?<\/time>/)
|
182
185
|
end
|
183
186
|
|
184
187
|
it 'has an alias of semantic_date_tim_range_tag' do
|
185
|
-
semantic_date_time_range_tag(date_object, date_tomorrow_object).must_match
|
188
|
+
semantic_date_time_range_tag(date_object, date_tomorrow_object).must_match(/<time.+?semantic.+?date.+?from.+?>/)
|
186
189
|
end
|
187
190
|
|
188
191
|
it 'allows to pass :format' do
|
189
192
|
semantic_date_time_range_tag(date_object, date_tomorrow_object, format: :test).must_include '~'
|
193
|
+
semantic_time_tag(time_object, format: :test).must_include 'data-format="test"'
|
190
194
|
end
|
191
195
|
end
|
192
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_date_time_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|