cable_ready 5.0.0.pre2 → 5.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/Gemfile.lock +71 -69
- data/lib/cable_ready/config.rb +2 -0
- data/lib/cable_ready/operation_builder.rb +6 -9
- data/lib/cable_ready/version.rb +1 -1
- data/package.json +1 -1
- data/test/lib/cable_ready/cable_car_test.rb +5 -5
- data/test/lib/cable_ready/operation_builder_test.rb +26 -48
- data/yarn.lock +3 -3
- metadata +9 -10
- data/tags +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 373a72dbd75eb888edac2ccf0d86cfd3cf2733efa69691ce6860886efdac64f9
|
4
|
+
data.tar.gz: 247ea517c6fe32417a06daaefd726ed10a4f2303ca1bdd6cb7e8bd175cbcb2ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03bab6e32acfe5660bebcb08a4b5f782a92b1cf297fdf74627b804f435f55873991202fcf8c715a5644598f5d00af8fa9b4069fb6dcb254c4d4524d3d68820c
|
7
|
+
data.tar.gz: a3ca97dfb6d81aa0d7c12e9db9722b1b2eec834cc15be0b066493ccdc1da99031557fe4c0ffd915f40ed9dd09de8d4ac8e28be4b4c3d0dc7bafbd8240b7ab862
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v5.0.0.pre2](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre2) (2021-07-21)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre1...v5.0.0.pre2)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- register a CableReady JSON MIME type [\#140](https://github.com/stimulusreflex/cable_ready/pull/140) ([existentialmutt](https://github.com/existentialmutt))
|
10
|
+
- Smart options \(they grow up so fast\) [\#136](https://github.com/stimulusreflex/cable_ready/pull/136) ([leastbad](https://github.com/leastbad))
|
11
|
+
- Support `to_dom_selector` for operation selectors [\#135](https://github.com/stimulusreflex/cable_ready/pull/135) ([jaredcwhite](https://github.com/jaredcwhite))
|
12
|
+
- dom\_id should always be lowercase [\#129](https://github.com/stimulusreflex/cable_ready/pull/129) ([leastbad](https://github.com/leastbad))
|
13
|
+
|
14
|
+
**Fixed bugs:**
|
15
|
+
|
16
|
+
- Improve install experience [\#128](https://github.com/stimulusreflex/cable_ready/pull/128) ([leastbad](https://github.com/leastbad))
|
17
|
+
|
18
|
+
**Closed issues:**
|
19
|
+
|
20
|
+
- Idea: ability to pass any object which responds to `to_dom_selector` as a selector [\#134](https://github.com/stimulusreflex/cable_ready/issues/134)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- Bump addressable from 2.7.0 to 2.8.0 [\#141](https://github.com/stimulusreflex/cable_ready/pull/141) ([dependabot[bot]](https://github.com/apps/dependabot))
|
25
|
+
- chore: make webpack happy with no sideEffects [\#138](https://github.com/stimulusreflex/cable_ready/pull/138) ([ParamagicDev](https://github.com/ParamagicDev))
|
26
|
+
|
27
|
+
## [v5.0.0.pre1](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre1) (2021-06-02)
|
28
|
+
|
29
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre0...v5.0.0.pre1)
|
30
|
+
|
31
|
+
**Merged pull requests:**
|
32
|
+
|
33
|
+
- Include app folder in release [\#133](https://github.com/stimulusreflex/cable_ready/pull/133) ([julianrubisch](https://github.com/julianrubisch))
|
34
|
+
|
3
35
|
## [v5.0.0.pre0](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre0) (2021-05-20)
|
4
36
|
|
5
37
|
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v4.5.0...v5.0.0.pre0)
|
data/Gemfile.lock
CHANGED
@@ -1,67 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (5.0.0.
|
4
|
+
cable_ready (5.0.0.pre3)
|
5
5
|
rails (>= 5.2)
|
6
6
|
thread-local (>= 1.1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.1.4)
|
12
|
-
actionpack (= 6.1.4)
|
13
|
-
activesupport (= 6.1.4)
|
11
|
+
actioncable (6.1.4.1)
|
12
|
+
actionpack (= 6.1.4.1)
|
13
|
+
activesupport (= 6.1.4.1)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.1.4)
|
17
|
-
actionpack (= 6.1.4)
|
18
|
-
activejob (= 6.1.4)
|
19
|
-
activerecord (= 6.1.4)
|
20
|
-
activestorage (= 6.1.4)
|
21
|
-
activesupport (= 6.1.4)
|
16
|
+
actionmailbox (6.1.4.1)
|
17
|
+
actionpack (= 6.1.4.1)
|
18
|
+
activejob (= 6.1.4.1)
|
19
|
+
activerecord (= 6.1.4.1)
|
20
|
+
activestorage (= 6.1.4.1)
|
21
|
+
activesupport (= 6.1.4.1)
|
22
22
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.1.4)
|
24
|
-
actionpack (= 6.1.4)
|
25
|
-
actionview (= 6.1.4)
|
26
|
-
activejob (= 6.1.4)
|
27
|
-
activesupport (= 6.1.4)
|
23
|
+
actionmailer (6.1.4.1)
|
24
|
+
actionpack (= 6.1.4.1)
|
25
|
+
actionview (= 6.1.4.1)
|
26
|
+
activejob (= 6.1.4.1)
|
27
|
+
activesupport (= 6.1.4.1)
|
28
28
|
mail (~> 2.5, >= 2.5.4)
|
29
29
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.1.4)
|
31
|
-
actionview (= 6.1.4)
|
32
|
-
activesupport (= 6.1.4)
|
30
|
+
actionpack (6.1.4.1)
|
31
|
+
actionview (= 6.1.4.1)
|
32
|
+
activesupport (= 6.1.4.1)
|
33
33
|
rack (~> 2.0, >= 2.0.9)
|
34
34
|
rack-test (>= 0.6.3)
|
35
35
|
rails-dom-testing (~> 2.0)
|
36
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.1.4)
|
38
|
-
actionpack (= 6.1.4)
|
39
|
-
activerecord (= 6.1.4)
|
40
|
-
activestorage (= 6.1.4)
|
41
|
-
activesupport (= 6.1.4)
|
37
|
+
actiontext (6.1.4.1)
|
38
|
+
actionpack (= 6.1.4.1)
|
39
|
+
activerecord (= 6.1.4.1)
|
40
|
+
activestorage (= 6.1.4.1)
|
41
|
+
activesupport (= 6.1.4.1)
|
42
42
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.1.4)
|
44
|
-
activesupport (= 6.1.4)
|
43
|
+
actionview (6.1.4.1)
|
44
|
+
activesupport (= 6.1.4.1)
|
45
45
|
builder (~> 3.1)
|
46
46
|
erubi (~> 1.4)
|
47
47
|
rails-dom-testing (~> 2.0)
|
48
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.1.4)
|
50
|
-
activesupport (= 6.1.4)
|
49
|
+
activejob (6.1.4.1)
|
50
|
+
activesupport (= 6.1.4.1)
|
51
51
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.1.4)
|
53
|
-
activesupport (= 6.1.4)
|
54
|
-
activerecord (6.1.4)
|
55
|
-
activemodel (= 6.1.4)
|
56
|
-
activesupport (= 6.1.4)
|
57
|
-
activestorage (6.1.4)
|
58
|
-
actionpack (= 6.1.4)
|
59
|
-
activejob (= 6.1.4)
|
60
|
-
activerecord (= 6.1.4)
|
61
|
-
activesupport (= 6.1.4)
|
52
|
+
activemodel (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
|
+
activerecord (6.1.4.1)
|
55
|
+
activemodel (= 6.1.4.1)
|
56
|
+
activesupport (= 6.1.4.1)
|
57
|
+
activestorage (6.1.4.1)
|
58
|
+
actionpack (= 6.1.4.1)
|
59
|
+
activejob (= 6.1.4.1)
|
60
|
+
activerecord (= 6.1.4.1)
|
61
|
+
activesupport (= 6.1.4.1)
|
62
62
|
marcel (~> 1.0.0)
|
63
63
|
mini_mime (>= 1.1.0)
|
64
|
-
activesupport (6.1.4)
|
64
|
+
activesupport (6.1.4.1)
|
65
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
66
|
i18n (>= 1.6, < 2)
|
67
67
|
minitest (>= 5.1)
|
@@ -70,7 +70,7 @@ GEM
|
|
70
70
|
addressable (2.8.0)
|
71
71
|
public_suffix (>= 2.0.2, < 5.0)
|
72
72
|
ast (2.4.2)
|
73
|
-
async (1.30.
|
73
|
+
async (1.30.1)
|
74
74
|
console (~> 1.10)
|
75
75
|
nio4r (~> 2.3)
|
76
76
|
timers (~> 4.1)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
fiber-local
|
96
96
|
crass (1.0.6)
|
97
97
|
erubi (1.10.0)
|
98
|
-
faraday (1.
|
98
|
+
faraday (1.7.0)
|
99
99
|
faraday-em_http (~> 1.0)
|
100
100
|
faraday-em_synchrony (~> 1.0)
|
101
101
|
faraday-excon (~> 1.1)
|
@@ -103,6 +103,7 @@ GEM
|
|
103
103
|
faraday-net_http (~> 1.0)
|
104
104
|
faraday-net_http_persistent (~> 1.1)
|
105
105
|
faraday-patron (~> 1.0)
|
106
|
+
faraday-rack (~> 1.0)
|
106
107
|
multipart-post (>= 1.2, < 3)
|
107
108
|
ruby2_keywords (>= 0.0.4)
|
108
109
|
faraday-em_http (1.0.0)
|
@@ -114,6 +115,7 @@ GEM
|
|
114
115
|
faraday-net_http (1.0.1)
|
115
116
|
faraday-net_http_persistent (1.2.0)
|
116
117
|
faraday-patron (1.0.0)
|
118
|
+
faraday-rack (1.0.0)
|
117
119
|
fiber-local (1.0.0)
|
118
120
|
github_changelog_generator (1.16.4)
|
119
121
|
activesupport
|
@@ -124,11 +126,11 @@ GEM
|
|
124
126
|
octokit (~> 4.6)
|
125
127
|
rainbow (>= 2.2.1)
|
126
128
|
rake (>= 10.0)
|
127
|
-
globalid (0.
|
128
|
-
activesupport (>=
|
129
|
+
globalid (0.5.2)
|
130
|
+
activesupport (>= 5.0)
|
129
131
|
i18n (1.8.10)
|
130
132
|
concurrent-ruby (~> 1.0)
|
131
|
-
loofah (2.
|
133
|
+
loofah (2.12.0)
|
132
134
|
crass (~> 1.0.2)
|
133
135
|
nokogiri (>= 1.5.9)
|
134
136
|
magic_frozen_string_literal (1.2.0)
|
@@ -137,14 +139,14 @@ GEM
|
|
137
139
|
marcel (1.0.1)
|
138
140
|
method_source (0.9.2)
|
139
141
|
mini_mime (1.1.0)
|
140
|
-
mini_portile2 (2.
|
142
|
+
mini_portile2 (2.6.1)
|
141
143
|
minitest (5.14.4)
|
142
144
|
mocha (1.13.0)
|
143
145
|
multi_json (1.15.0)
|
144
146
|
multipart-post (2.1.1)
|
145
|
-
nio4r (2.5.
|
146
|
-
nokogiri (1.
|
147
|
-
mini_portile2 (~> 2.
|
147
|
+
nio4r (2.5.8)
|
148
|
+
nokogiri (1.12.3)
|
149
|
+
mini_portile2 (~> 2.6.1)
|
148
150
|
racc (~> 1.4)
|
149
151
|
octokit (4.21.0)
|
150
152
|
faraday (>= 0.9)
|
@@ -169,29 +171,29 @@ GEM
|
|
169
171
|
rack (2.2.3)
|
170
172
|
rack-test (1.1.0)
|
171
173
|
rack (>= 1.0, < 3)
|
172
|
-
rails (6.1.4)
|
173
|
-
actioncable (= 6.1.4)
|
174
|
-
actionmailbox (= 6.1.4)
|
175
|
-
actionmailer (= 6.1.4)
|
176
|
-
actionpack (= 6.1.4)
|
177
|
-
actiontext (= 6.1.4)
|
178
|
-
actionview (= 6.1.4)
|
179
|
-
activejob (= 6.1.4)
|
180
|
-
activemodel (= 6.1.4)
|
181
|
-
activerecord (= 6.1.4)
|
182
|
-
activestorage (= 6.1.4)
|
183
|
-
activesupport (= 6.1.4)
|
174
|
+
rails (6.1.4.1)
|
175
|
+
actioncable (= 6.1.4.1)
|
176
|
+
actionmailbox (= 6.1.4.1)
|
177
|
+
actionmailer (= 6.1.4.1)
|
178
|
+
actionpack (= 6.1.4.1)
|
179
|
+
actiontext (= 6.1.4.1)
|
180
|
+
actionview (= 6.1.4.1)
|
181
|
+
activejob (= 6.1.4.1)
|
182
|
+
activemodel (= 6.1.4.1)
|
183
|
+
activerecord (= 6.1.4.1)
|
184
|
+
activestorage (= 6.1.4.1)
|
185
|
+
activesupport (= 6.1.4.1)
|
184
186
|
bundler (>= 1.15.0)
|
185
|
-
railties (= 6.1.4)
|
187
|
+
railties (= 6.1.4.1)
|
186
188
|
sprockets-rails (>= 2.0.0)
|
187
189
|
rails-dom-testing (2.0.3)
|
188
190
|
activesupport (>= 4.2.0)
|
189
191
|
nokogiri (>= 1.6)
|
190
|
-
rails-html-sanitizer (1.
|
192
|
+
rails-html-sanitizer (1.4.1)
|
191
193
|
loofah (~> 2.3)
|
192
|
-
railties (6.1.4)
|
193
|
-
actionpack (= 6.1.4)
|
194
|
-
activesupport (= 6.1.4)
|
194
|
+
railties (6.1.4.1)
|
195
|
+
actionpack (= 6.1.4.1)
|
196
|
+
activesupport (= 6.1.4.1)
|
195
197
|
method_source
|
196
198
|
rake (>= 0.13)
|
197
199
|
thor (~> 1.0)
|
@@ -199,16 +201,16 @@ GEM
|
|
199
201
|
rake (13.0.6)
|
200
202
|
regexp_parser (2.1.1)
|
201
203
|
rexml (3.2.5)
|
202
|
-
rubocop (1.18.
|
204
|
+
rubocop (1.18.4)
|
203
205
|
parallel (~> 1.10)
|
204
206
|
parser (>= 3.0.0.0)
|
205
207
|
rainbow (>= 2.2.2, < 4.0)
|
206
208
|
regexp_parser (>= 1.8, < 3.0)
|
207
209
|
rexml
|
208
|
-
rubocop-ast (>= 1.
|
210
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
209
211
|
ruby-progressbar (~> 1.7)
|
210
212
|
unicode-display_width (>= 1.4.0, < 3.0)
|
211
|
-
rubocop-ast (1.
|
213
|
+
rubocop-ast (1.10.0)
|
212
214
|
parser (>= 3.0.1.1)
|
213
215
|
rubocop-performance (1.11.4)
|
214
216
|
rubocop (>= 1.7.0, < 2.0)
|
@@ -225,8 +227,8 @@ GEM
|
|
225
227
|
actionpack (>= 4.0)
|
226
228
|
activesupport (>= 4.0)
|
227
229
|
sprockets (>= 3.0.0)
|
228
|
-
standard (1.1.
|
229
|
-
rubocop (= 1.18.
|
230
|
+
standard (1.1.7)
|
231
|
+
rubocop (= 1.18.4)
|
230
232
|
rubocop-performance (= 1.11.4)
|
231
233
|
standardrb (1.0.0)
|
232
234
|
standard
|
data/lib/cable_ready/config.rb
CHANGED
@@ -48,7 +48,8 @@ module CableReady
|
|
48
48
|
@previous_selector = options["selector"]
|
49
49
|
options["selector"] = identifiable?(previous_selector) ? dom_id(previous_selector) : previous_selector
|
50
50
|
end
|
51
|
-
|
51
|
+
options["operation"] = name.to_s.camelize(:lower)
|
52
|
+
@enqueued_operations << options
|
52
53
|
self
|
53
54
|
}
|
54
55
|
end
|
@@ -57,26 +58,22 @@ module CableReady
|
|
57
58
|
@enqueued_operations.to_json(*args)
|
58
59
|
end
|
59
60
|
|
60
|
-
def apply!(operations = "
|
61
|
+
def apply!(operations = "[]")
|
61
62
|
operations = begin
|
62
63
|
JSON.parse(operations.is_a?(String) ? operations : operations.to_json)
|
63
64
|
rescue JSON::ParserError
|
64
65
|
{}
|
65
66
|
end
|
66
|
-
operations
|
67
|
-
operation.each do |enqueued_operation|
|
68
|
-
@enqueued_operations[name.to_s] << enqueued_operation
|
69
|
-
end
|
70
|
-
end
|
67
|
+
@enqueued_operations.push(operations)
|
71
68
|
self
|
72
69
|
end
|
73
70
|
|
74
71
|
def operations_payload
|
75
|
-
@enqueued_operations.
|
72
|
+
@enqueued_operations.map { |operation| operation.deep_transform_keys! { |key| key.to_s.camelize(:lower) } }
|
76
73
|
end
|
77
74
|
|
78
75
|
def reset!
|
79
|
-
@enqueued_operations =
|
76
|
+
@enqueued_operations = []
|
80
77
|
@previous_selector = nil
|
81
78
|
end
|
82
79
|
end
|
data/lib/cable_ready/version.rb
CHANGED
data/package.json
CHANGED
@@ -11,19 +11,19 @@ class CableReady::CableCarTest < ActiveSupport::TestCase
|
|
11
11
|
test "dispatch should return json-ifiable payload" do
|
12
12
|
CableReady::CableCar.instance.reset!
|
13
13
|
dispatch = CableReady::CableCar.instance.inner_html(selector: "#users", html: "<span>winning</span>").dispatch
|
14
|
-
assert_equal({"
|
14
|
+
assert_equal([{"operation" => "innerHtml", "selector" => "#users", "html" => "<span>winning</span>"}], dispatch)
|
15
15
|
end
|
16
16
|
|
17
17
|
test "dispatch should clear operations" do
|
18
18
|
CableReady::CableCar.instance.reset!
|
19
19
|
CableReady::CableCar.instance.inner_html(selector: "#users", html: "<span>winning</span>").dispatch
|
20
|
-
assert_equal(
|
20
|
+
assert_equal([], CableReady::CableCar.instance.instance_variable_get(:@enqueued_operations))
|
21
21
|
end
|
22
22
|
|
23
23
|
test "dispatch should maintain operations if clear is false" do
|
24
24
|
CableReady::CableCar.instance.reset!
|
25
25
|
CableReady::CableCar.instance.inner_html(selector: "#users", html: "<span>winning</span>").dispatch(clear: false)
|
26
|
-
assert_equal({"
|
26
|
+
assert_equal([{"operation" => "innerHtml", "selector" => "#users", "html" => "<span>winning</span>"}], CableReady::CableCar.instance.instance_variable_get(:@enqueued_operations))
|
27
27
|
end
|
28
28
|
|
29
29
|
test "selectors should accept any object which respond_to? to_dom_selector" do
|
@@ -34,7 +34,7 @@ class CableReady::CableCarTest < ActiveSupport::TestCase
|
|
34
34
|
end
|
35
35
|
end.new("users")
|
36
36
|
dispatch = CableReady::CableCar.instance.inner_html(selector: my_object, html: "<span>winning</span>").dispatch
|
37
|
-
assert_equal({"
|
37
|
+
assert_equal([{"operation" => "innerHtml", "selector" => ".users", "html" => "<span>winning</span>"}], dispatch)
|
38
38
|
end
|
39
39
|
|
40
40
|
test "selectors should accept any object which respond_to? to_dom_id" do
|
@@ -45,6 +45,6 @@ class CableReady::CableCarTest < ActiveSupport::TestCase
|
|
45
45
|
end
|
46
46
|
end.new("users")
|
47
47
|
dispatch = CableReady::CableCar.instance.inner_html(selector: my_object, html: "<span>winning</span>").dispatch
|
48
|
-
assert_equal({"
|
48
|
+
assert_equal([{"operation" => "innerHtml", "selector" => "#users", "html" => "<span>winning</span>"}], dispatch)
|
49
49
|
end
|
50
50
|
end
|
@@ -55,42 +55,42 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
55
55
|
|
56
56
|
operations = @operation_builder.instance_variable_get(:@enqueued_operations)
|
57
57
|
|
58
|
-
assert_equal 1, operations
|
59
|
-
assert_equal({"name" => "passed_option"
|
58
|
+
assert_equal 1, operations.size
|
59
|
+
assert_equal({"name" => "passed_option", "operation" => "foobar"}, operations.first)
|
60
60
|
end
|
61
61
|
|
62
62
|
test "should json-ify operations" do
|
63
63
|
@operation_builder.add_operation_method("foobar")
|
64
64
|
@operation_builder.foobar({name: "passed_option"})
|
65
|
-
assert_equal("{\"
|
65
|
+
assert_equal("[{\"name\":\"passed_option\",\"operation\":\"foobar\"}]", @operation_builder.to_json)
|
66
66
|
end
|
67
67
|
|
68
68
|
test "should apply! many operations" do
|
69
|
-
@operation_builder.apply!(
|
69
|
+
@operation_builder.apply!({name: "passed_option"})
|
70
70
|
|
71
71
|
operations = @operation_builder.instance_variable_get(:@enqueued_operations)
|
72
|
-
assert_equal 1, operations
|
73
|
-
assert_equal({"name" => "passed_option"}, operations
|
72
|
+
assert_equal 1, operations.size
|
73
|
+
assert_equal({"name" => "passed_option"}, operations.first)
|
74
74
|
end
|
75
75
|
|
76
76
|
test "should apply! many operations from a string" do
|
77
|
-
@operation_builder.apply!(JSON.generate({
|
77
|
+
@operation_builder.apply!(JSON.generate({name: "passed_option"}))
|
78
78
|
|
79
79
|
operations = @operation_builder.instance_variable_get(:@enqueued_operations)
|
80
|
-
assert_equal 1, operations
|
81
|
-
assert_equal({"name" => "passed_option"}, operations
|
80
|
+
assert_equal 1, operations.size
|
81
|
+
assert_equal({"name" => "passed_option"}, operations.first)
|
82
82
|
end
|
83
83
|
|
84
84
|
test "operations payload should omit empty operations" do
|
85
85
|
@operation_builder.add_operation_method("foobar")
|
86
86
|
payload = @operation_builder.operations_payload
|
87
|
-
assert_equal(
|
87
|
+
assert_equal([], payload)
|
88
88
|
end
|
89
89
|
|
90
90
|
test "operations payload should camelize keys" do
|
91
91
|
@operation_builder.add_operation_method("foo_bar")
|
92
92
|
@operation_builder.foo_bar({beep_boop: "passed_option"})
|
93
|
-
assert_equal({"
|
93
|
+
assert_equal([{"operation" => "fooBar", "beepBoop" => "passed_option"}], @operation_builder.operations_payload)
|
94
94
|
end
|
95
95
|
|
96
96
|
test "should take first argument as selector" do
|
@@ -98,9 +98,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
98
98
|
|
99
99
|
@operation_builder.inner_html("#smelly", html: "<span>I rock</span>")
|
100
100
|
|
101
|
-
operations = {
|
102
|
-
"innerHtml" => [{"html" => "<span>I rock</span>", "selector" => "#smelly"}]
|
103
|
-
}
|
101
|
+
operations = [{"operation" => "innerHtml", "html" => "<span>I rock</span>", "selector" => "#smelly"}]
|
104
102
|
|
105
103
|
assert_equal(operations, @operation_builder.operations_payload)
|
106
104
|
end
|
@@ -111,10 +109,10 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
111
109
|
|
112
110
|
@operation_builder.set_focus("#smelly").inner_html(html: "<span>I rock</span>")
|
113
111
|
|
114
|
-
operations =
|
115
|
-
"
|
116
|
-
"
|
117
|
-
|
112
|
+
operations = [
|
113
|
+
{"operation" => "setFocus", "selector" => "#smelly"},
|
114
|
+
{"operation" => "innerHtml", "html" => "<span>I rock</span>", "selector" => "#smelly"}
|
115
|
+
]
|
118
116
|
|
119
117
|
assert_equal(operations, @operation_builder.operations_payload)
|
120
118
|
end
|
@@ -127,7 +125,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
127
125
|
|
128
126
|
@operation_builder.inner_html(html: "<span>winning</span>")
|
129
127
|
|
130
|
-
assert_equal({"
|
128
|
+
assert_equal([{"operation" => "innerHtml", "html" => "<span>winning</span>"}], @operation_builder.operations_payload)
|
131
129
|
end
|
132
130
|
|
133
131
|
test "should use previous_selector if present and should use `selector` if explicitly provided" do
|
@@ -136,15 +134,11 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
136
134
|
|
137
135
|
@operation_builder.set_focus("#smelly").inner_html(html: "<span>I rock</span>").inner_html(html: "<span>I rock too</span>", selector: "#smelly2")
|
138
136
|
|
139
|
-
operations =
|
140
|
-
"setFocus" =>
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
{"html" => "<span>I rock</span>", "selector" => "#smelly"},
|
145
|
-
{"html" => "<span>I rock too</span>", "selector" => "#smelly2"}
|
146
|
-
]
|
147
|
-
}
|
137
|
+
operations = [
|
138
|
+
{"operation" => "setFocus", "selector" => "#smelly"},
|
139
|
+
{"operation" => "innerHtml", "html" => "<span>I rock</span>", "selector" => "#smelly"},
|
140
|
+
{"operation" => "innerHtml", "html" => "<span>I rock too</span>", "selector" => "#smelly2"}
|
141
|
+
]
|
148
142
|
|
149
143
|
assert_equal(operations, @operation_builder.operations_payload)
|
150
144
|
end
|
@@ -155,11 +149,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
155
149
|
|
156
150
|
@operation_builder.inner_html(html: death)
|
157
151
|
|
158
|
-
operations = {
|
159
|
-
"innerHtml" => [
|
160
|
-
{"html" => "I rock"}
|
161
|
-
]
|
162
|
-
}
|
152
|
+
operations = [{"operation" => "innerHtml", "html" => "I rock"}]
|
163
153
|
|
164
154
|
assert_equal(operations, @operation_builder.operations_payload)
|
165
155
|
end
|
@@ -170,11 +160,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
170
160
|
|
171
161
|
@operation_builder.inner_html(death, html: death)
|
172
162
|
|
173
|
-
operations = {
|
174
|
-
"innerHtml" => [
|
175
|
-
{"html" => "I rock", "selector" => "#death"}
|
176
|
-
]
|
177
|
-
}
|
163
|
+
operations = [{"operation" => "innerHtml", "html" => "I rock", "selector" => "#death"}]
|
178
164
|
|
179
165
|
assert_equal(operations, @operation_builder.operations_payload)
|
180
166
|
end
|
@@ -185,11 +171,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
185
171
|
|
186
172
|
@operation_builder.inner_html(death)
|
187
173
|
|
188
|
-
operations = {
|
189
|
-
"innerHtml" => [
|
190
|
-
{"html" => "I rock", "domId" => "death"}
|
191
|
-
]
|
192
|
-
}
|
174
|
+
operations = [{"operation" => "innerHtml", "html" => "I rock", "domId" => "death"}]
|
193
175
|
|
194
176
|
assert_equal(operations, @operation_builder.operations_payload)
|
195
177
|
end
|
@@ -200,11 +182,7 @@ class CableReady::OperationBuilderTest < ActiveSupport::TestCase
|
|
200
182
|
|
201
183
|
@operation_builder.inner_html(life)
|
202
184
|
|
203
|
-
operations = {
|
204
|
-
"innerHtml" => [
|
205
|
-
{"html" => "You go, girl", "domId" => "life"}
|
206
|
-
]
|
207
|
-
}
|
185
|
+
operations = [{"operation" => "innerHtml", "html" => "You go, girl", "domId" => "life"}]
|
208
186
|
|
209
187
|
assert_equal(operations, @operation_builder.operations_payload)
|
210
188
|
end
|
data/yarn.lock
CHANGED
@@ -1726,9 +1726,9 @@ path-key@^3.0.0, path-key@^3.1.0:
|
|
1726
1726
|
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
|
1727
1727
|
|
1728
1728
|
path-parse@^1.0.6:
|
1729
|
-
version "1.0.
|
1730
|
-
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.
|
1731
|
-
integrity sha512-
|
1729
|
+
version "1.0.7"
|
1730
|
+
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
1731
|
+
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
1732
1732
|
|
1733
1733
|
path-type@^4.0.0:
|
1734
1734
|
version "4.0.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cable_ready
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description:
|
140
140
|
email:
|
141
141
|
- natehop@gmail.com
|
142
142
|
executables: []
|
@@ -176,7 +176,6 @@ files:
|
|
176
176
|
- lib/generators/cable_ready/stream_from_generator.rb
|
177
177
|
- lib/generators/cable_ready/templates/config/initializers/cable_ready.rb
|
178
178
|
- package.json
|
179
|
-
- tags
|
180
179
|
- test/lib/cable_ready/cable_car_test.rb
|
181
180
|
- test/lib/cable_ready/identifiable_test.rb
|
182
181
|
- test/lib/cable_ready/operation_builder_test.rb
|
@@ -188,7 +187,7 @@ homepage: https://github.com/stimulusreflex/cable_ready
|
|
188
187
|
licenses:
|
189
188
|
- MIT
|
190
189
|
metadata: {}
|
191
|
-
post_install_message:
|
190
|
+
post_install_message:
|
192
191
|
rdoc_options: []
|
193
192
|
require_paths:
|
194
193
|
- lib
|
@@ -203,14 +202,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
202
|
- !ruby/object:Gem::Version
|
204
203
|
version: 1.3.1
|
205
204
|
requirements: []
|
206
|
-
rubygems_version: 3.
|
207
|
-
signing_key:
|
205
|
+
rubygems_version: 3.2.3
|
206
|
+
signing_key:
|
208
207
|
specification_version: 4
|
209
208
|
summary: Out-of-Band Server Triggered DOM Operations
|
210
209
|
test_files:
|
211
|
-
- test/support/generator_test_helpers.rb
|
212
|
-
- test/lib/generators/cable_ready/channel_generator_test.rb
|
213
210
|
- test/lib/cable_ready/cable_car_test.rb
|
214
211
|
- test/lib/cable_ready/identifiable_test.rb
|
215
212
|
- test/lib/cable_ready/operation_builder_test.rb
|
213
|
+
- test/lib/generators/cable_ready/channel_generator_test.rb
|
214
|
+
- test/support/generator_test_helpers.rb
|
216
215
|
- test/test_helper.rb
|
data/tags
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
-
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
-
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
-
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
-
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
-
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
-
Broadcaster lib/cable_ready/broadcaster.rb /^ module Broadcaster$/;" m class:CableReady
|
8
|
-
CableReady lib/cable_ready.rb /^module CableReady$/;" m
|
9
|
-
CableReady lib/cable_ready/broadcaster.rb /^module CableReady$/;" m
|
10
|
-
CableReady lib/cable_ready/channel.rb /^module CableReady$/;" m
|
11
|
-
CableReady lib/cable_ready/channels.rb /^module CableReady$/;" m
|
12
|
-
CableReady lib/cable_ready/config.rb /^module CableReady$/;" m
|
13
|
-
CableReady lib/cable_ready/version.rb /^module CableReady$/;" m
|
14
|
-
CableReady lib/generators/cable_ready/channel_generator.rb /^class CableReady::ChannelGenerator < Rails::Generators::NamedBase$/;" c
|
15
|
-
CableReady test/lib/generators/cable_ready/channel_generator_test.rb /^class CableReady::ChannelGeneratorTest < Rails::Generators::TestCase$/;" c
|
16
|
-
Channel lib/cable_ready/channel.rb /^ class Channel$/;" c class:CableReady
|
17
|
-
Channels lib/cable_ready/channels.rb /^ class Channels$/;" c class:CableReady
|
18
|
-
ClassMethods test/support/generator_test_helpers.rb /^ module ClassMethods$/;" m class:GeneratorTestHelpers
|
19
|
-
Config lib/cable_ready/config.rb /^ class Config$/;" c class:CableReady
|
20
|
-
Engine lib/cable_ready.rb /^ class Engine < Rails::Engine$/;" c class:CableReady
|
21
|
-
GeneratorTestHelpers test/support/generator_test_helpers.rb /^module GeneratorTestHelpers$/;" m
|
22
|
-
[] lib/cable_ready/channels.rb /^ def [](identifier)$/;" f class:CableReady.Channels
|
23
|
-
add_operation_method lib/cable_ready/channel.rb /^ def add_operation_method(name)$/;" f class:CableReady.Channel
|
24
|
-
add_operation_name lib/cable_ready/config.rb /^ def add_operation_name(name)$/;" f class:CableReady.Config
|
25
|
-
broadcast lib/cable_ready/channel.rb /^ def broadcast(clear: true)$/;" f class:CableReady.Channel
|
26
|
-
broadcast lib/cable_ready/channels.rb /^ def broadcast(*identifiers, clear: true)$/;" f class:CableReady.Channels
|
27
|
-
broadcast_to lib/cable_ready/channel.rb /^ def broadcast_to(model, clear: true)$/;" f class:CableReady.Channel
|
28
|
-
broadcast_to lib/cable_ready/channels.rb /^ def broadcast_to(model, *identifiers, clear: true)$/;" f class:CableReady.Channels
|
29
|
-
broadcastable_operations lib/cable_ready/channel.rb /^ def broadcastable_operations$/;" f class:CableReady.Channel
|
30
|
-
cable_ready lib/cable_ready/broadcaster.rb /^ def cable_ready$/;" f class:CableReady.Broadcaster
|
31
|
-
check_options lib/generators/cable_ready/channel_generator.rb /^ def check_options$/;" f class:CableReady
|
32
|
-
config lib/cable_ready.rb /^ def self.config$/;" F class:CableReady
|
33
|
-
configure lib/cable_ready.rb /^ def self.configure$/;" F class:CableReady
|
34
|
-
const.bubbles javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
35
|
-
const.cancelable javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
36
|
-
const.detail javascript/utils.js /^ const init = { bubbles: true, cancelable: true, detail: detail }$/;" p
|
37
|
-
const.value javascript/morph_callbacks.js /^ const ignore = { value: true }$/;" p
|
38
|
-
create_channel lib/generators/cable_ready/channel_generator.rb /^ def create_channel$/;" f class:CableReady
|
39
|
-
create_sample_app test/support/generator_test_helpers.rb /^ def create_sample_app$/;" f class:GeneratorTestHelpers.ClassMethods
|
40
|
-
default_operation_names lib/cable_ready/config.rb /^ def default_operation_names$/;" f class:CableReady.Config
|
41
|
-
dom_id lib/cable_ready/broadcaster.rb /^ def dom_id(record, prefix = nil)$/;" f class:CableReady.Broadcaster
|
42
|
-
enhance_channels lib/generators/cable_ready/channel_generator.rb /^ def enhance_channels$/;" f class:CableReady
|
43
|
-
export.INPUT javascript/enums.js /^ INPUT: true,$/;" p
|
44
|
-
export.OPTION javascript/enums.js /^ OPTION: true$/;" p
|
45
|
-
export.SELECT javascript/enums.js /^ SELECT: true$/;" p
|
46
|
-
export.TEXTAREA javascript/enums.js /^ TEXTAREA: true,$/;" p
|
47
|
-
export.color javascript/enums.js /^ color: true,$/;" p
|
48
|
-
export.date javascript/enums.js /^ date: true,$/;" p
|
49
|
-
export.datetime javascript/enums.js /^ datetime: true,$/;" p
|
50
|
-
export.datetime-local javascript/enums.js /^ 'datetime-local': true,$/;" p
|
51
|
-
export.email javascript/enums.js /^ email: true,$/;" p
|
52
|
-
export.month javascript/enums.js /^ month: true,$/;" p
|
53
|
-
export.number javascript/enums.js /^ number: true,$/;" p
|
54
|
-
export.password javascript/enums.js /^ password: true,$/;" p
|
55
|
-
export.range javascript/enums.js /^ range: true,$/;" p
|
56
|
-
export.search javascript/enums.js /^ search: true,$/;" p
|
57
|
-
export.select-multiple javascript/enums.js /^ 'select-multiple': true,$/;" p
|
58
|
-
export.select-one javascript/enums.js /^ 'select-one': true,$/;" p
|
59
|
-
export.tel javascript/enums.js /^ tel: true,$/;" p
|
60
|
-
export.text javascript/enums.js /^ text: true,$/;" p
|
61
|
-
export.textarea javascript/enums.js /^ textarea: true,$/;" p
|
62
|
-
export.time javascript/enums.js /^ time: true,$/;" p
|
63
|
-
export.url javascript/enums.js /^ url: true,$/;" p
|
64
|
-
export.week javascript/enums.js /^ week: true$/;" p
|
65
|
-
finalizer_for lib/cable_ready/channel.rb /^ def self.finalizer_for(identifier)$/;" F class:CableReady.Channel
|
66
|
-
identifier lib/generators/cable_ready/channel_generator.rb /^ def identifier$/;" f class:CableReady
|
67
|
-
included test/support/generator_test_helpers.rb /^ def self.included(base)$/;" F class:GeneratorTestHelpers
|
68
|
-
initialize lib/cable_ready/channel.rb /^ def initialize(identifier)$/;" f class:CableReady.Channel
|
69
|
-
initialize lib/cable_ready/channels.rb /^ def initialize$/;" f class:CableReady.Channels
|
70
|
-
initialize lib/cable_ready/config.rb /^ def initialize$/;" f class:CableReady.Config
|
71
|
-
observers lib/cable_ready/config.rb /^ def observers$/;" f class:CableReady.Config
|
72
|
-
operation_names lib/cable_ready/config.rb /^ def operation_names$/;" f class:CableReady.Config
|
73
|
-
option_given? lib/generators/cable_ready/channel_generator.rb /^ def option_given?$/;" f class:CableReady
|
74
|
-
prepare_destination test/support/generator_test_helpers.rb /^ def prepare_destination$/;" f class:GeneratorTestHelpers.ClassMethods
|
75
|
-
remove_sample_app test/support/generator_test_helpers.rb /^ def remove_sample_app$/;" f class:GeneratorTestHelpers.ClassMethods
|
76
|
-
reset lib/cable_ready/channel.rb /^ def reset$/;" f class:CableReady.Channel
|
77
|
-
resource lib/generators/cable_ready/channel_generator.rb /^ def resource$/;" f class:CableReady
|
78
|
-
sample_app_path test/support/generator_test_helpers.rb /^ def sample_app_path$/;" f class:GeneratorTestHelpers.ClassMethods
|
79
|
-
using_broadcast_to? lib/generators/cable_ready/channel_generator.rb /^ def using_broadcast_to?$/;" f class:CableReady
|
80
|
-
using_stimulus? lib/generators/cable_ready/channel_generator.rb /^ def using_stimulus?$/;" f class:CableReady
|