phlex-stimulus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +16 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +341 -0
  6. data/Rakefile +12 -0
  7. data/lib/generators/phlex/stimulus/controller/USAGE +5 -0
  8. data/lib/generators/phlex/stimulus/controller/controller_generator.rb +49 -0
  9. data/lib/generators/phlex/stimulus/controller/templates/component.rb.erb +30 -0
  10. data/lib/generators/phlex/stimulus/controller/templates/controller.ts.erb +23 -0
  11. data/lib/generators/phlex/stimulus/generator_mixin.rb +21 -0
  12. data/lib/generators/phlex/stimulus/install/USAGE +5 -0
  13. data/lib/generators/phlex/stimulus/install/install_generator.rb +111 -0
  14. data/lib/generators/phlex/stimulus/install/templates/app/components/base.rb.erb +29 -0
  15. data/lib/generators/phlex/stimulus/install/templates/app/components/chain_controller.rb.erb +29 -0
  16. data/lib/generators/phlex/stimulus/install/templates/app/components/classlist_controller.rb.erb +30 -0
  17. data/lib/generators/phlex/stimulus/install/templates/app/components/controller.rb.erb +10 -0
  18. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_chain.rb.erb +32 -0
  19. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_template.rb.erb +24 -0
  20. data/lib/generators/phlex/stimulus/install/templates/app/components/log_controller.rb.erb +33 -0
  21. data/lib/generators/phlex/stimulus/install/templates/app/components/sleep_controller.rb.erb +30 -0
  22. data/lib/generators/phlex/stimulus/install/templates/app/components.rb.erb +7 -0
  23. data/lib/generators/phlex/stimulus/install/templates/app/javascript/application.ts.erb +5 -0
  24. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/application.ts.erb +10 -0
  25. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chain_controller.ts.erb +32 -0
  26. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chainable_controller.ts.erb +44 -0
  27. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/classlist_controller.ts.erb +30 -0
  28. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/index.ts.erb +4 -0
  29. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/log_controller.ts.erb +25 -0
  30. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/sleep_controller.ts.erb +19 -0
  31. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/typed_controller.ts.erb +53 -0
  32. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/misc.ts.erb +37 -0
  33. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/template.ts.erb +11 -0
  34. data/lib/phlex/stimulus/components/base.rb +81 -0
  35. data/lib/phlex/stimulus/components/controller.rb +170 -0
  36. data/lib/phlex/stimulus/components.rb +9 -0
  37. data/lib/phlex/stimulus/version.rb +8 -0
  38. data/lib/phlex/stimulus.rb +15 -0
  39. data/sorbet/config +7 -0
  40. data/sorbet/rbi/annotations/.gitattributes +1 -0
  41. data/sorbet/rbi/annotations/actionmailer.rbi +15 -0
  42. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  43. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  44. data/sorbet/rbi/annotations/activejob.rbi +50 -0
  45. data/sorbet/rbi/annotations/activemodel.rbi +119 -0
  46. data/sorbet/rbi/annotations/activerecord.rbi +172 -0
  47. data/sorbet/rbi/annotations/activesupport.rbi +561 -0
  48. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  49. data/sorbet/rbi/annotations/minitest.rbi +116 -0
  50. data/sorbet/rbi/annotations/railties.rbi +104 -0
  51. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  52. data/sorbet/rbi/dsl/.gitattributes +1 -0
  53. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  54. data/sorbet/rbi/gems/.gitattributes +1 -0
  55. data/sorbet/rbi/gems/action_text-trix@2.1.19.rbi +9 -0
  56. data/sorbet/rbi/gems/actioncable@8.1.3.rbi +9 -0
  57. data/sorbet/rbi/gems/actionmailbox@8.1.3.rbi +9 -0
  58. data/sorbet/rbi/gems/actionmailer@8.1.3.rbi +9 -0
  59. data/sorbet/rbi/gems/actionpack@8.1.3.rbi +20478 -0
  60. data/sorbet/rbi/gems/actiontext@8.1.3.rbi +9 -0
  61. data/sorbet/rbi/gems/actionview@8.1.3.rbi +14722 -0
  62. data/sorbet/rbi/gems/activejob@8.1.3.rbi +9 -0
  63. data/sorbet/rbi/gems/activemodel@8.1.3.rbi +9 -0
  64. data/sorbet/rbi/gems/activerecord@8.1.3.rbi +9 -0
  65. data/sorbet/rbi/gems/activestorage@8.1.3.rbi +9 -0
  66. data/sorbet/rbi/gems/activesupport@8.1.3.rbi +20153 -0
  67. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  68. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  69. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  70. data/sorbet/rbi/gems/booleans@0.1.3.rbi +31 -0
  71. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  72. data/sorbet/rbi/gems/byebug@12.0.0.rbi +49 -0
  73. data/sorbet/rbi/gems/concurrent-ruby@1.3.8.rbi +10656 -0
  74. data/sorbet/rbi/gems/connection_pool@3.0.2.rbi +9 -0
  75. data/sorbet/rbi/gems/crass@1.0.7.rbi +648 -0
  76. data/sorbet/rbi/gems/date@3.5.1.rbi +391 -0
  77. data/sorbet/rbi/gems/drb@2.2.3.rbi +9 -0
  78. data/sorbet/rbi/gems/erb@6.0.6.rbi +1600 -0
  79. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  80. data/sorbet/rbi/gems/globalid@1.4.0.rbi +9 -0
  81. data/sorbet/rbi/gems/i18n@1.15.2.rbi +2285 -0
  82. data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
  83. data/sorbet/rbi/gems/json@2.21.1.rbi +2289 -0
  84. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  85. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  86. data/sorbet/rbi/gems/loofah@2.25.2.rbi +1134 -0
  87. data/sorbet/rbi/gems/mail@2.9.1.rbi +9 -0
  88. data/sorbet/rbi/gems/marcel@1.2.1.rbi +9 -0
  89. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  90. data/sorbet/rbi/gems/minitest@6.0.6.rbi +1482 -0
  91. data/sorbet/rbi/gems/net-imap@0.6.4.1.rbi +9 -0
  92. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  93. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +244 -0
  94. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +9 -0
  95. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  96. data/sorbet/rbi/gems/nio4r@2.7.5.rbi +9 -0
  97. data/sorbet/rbi/gems/nokogiri@1.19.4.rbi +8168 -0
  98. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  99. data/sorbet/rbi/gems/phlex-rails@2.4.0.rbi +1945 -0
  100. data/sorbet/rbi/gems/phlex@2.4.1.rbi +1413 -0
  101. data/sorbet/rbi/gems/pp@0.6.4.rbi +387 -0
  102. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +455 -0
  103. data/sorbet/rbi/gems/prism@1.9.0.rbi +42226 -0
  104. data/sorbet/rbi/gems/racc@1.8.1.rbi +165 -0
  105. data/sorbet/rbi/gems/rack-session@2.1.2.rbi +756 -0
  106. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +681 -0
  107. data/sorbet/rbi/gems/rack@3.2.6.rbi +4653 -0
  108. data/sorbet/rbi/gems/rackup@2.3.1.rbi +9 -0
  109. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +517 -0
  110. data/sorbet/rbi/gems/rails-html-sanitizer@1.7.1.rbi +620 -0
  111. data/sorbet/rbi/gems/rails@8.1.3.rbi +9 -0
  112. data/sorbet/rbi/gems/railties@8.1.3.rbi +3507 -0
  113. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  114. data/sorbet/rbi/gems/rake@13.4.2.rbi +3130 -0
  115. data/sorbet/rbi/gems/rbi@0.4.0.rbi +5706 -0
  116. data/sorbet/rbi/gems/rbs@4.0.3.rbi +6908 -0
  117. data/sorbet/rbi/gems/refract@1.1.0.rbi +9 -0
  118. data/sorbet/rbi/gems/reline@0.6.3.rbi +2446 -0
  119. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  120. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  121. data/sorbet/rbi/gems/rubocop-espago@1.3.0.rbi +9 -0
  122. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  123. data/sorbet/rbi/gems/rubydex@0.2.9.rbi +841 -0
  124. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  125. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +544 -0
  126. data/sorbet/rbi/gems/spoom@1.8.4.rbi +6738 -0
  127. data/sorbet/rbi/gems/tapioca@0.19.2.rbi +3599 -0
  128. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  129. data/sorbet/rbi/gems/timeout@0.6.1.rbi +200 -0
  130. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  131. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5474 -0
  132. data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
  133. data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
  134. data/sorbet/rbi/gems/uri@1.1.1.rbi +2402 -0
  135. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  136. data/sorbet/rbi/gems/websocket-driver@0.8.2.rbi +9 -0
  137. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  138. data/sorbet/rbi/gems/zeitwerk@2.8.2.rbi +9 -0
  139. data/sorbet/rbi/shims/gems/parser.rbi +12 -0
  140. data/sorbet/rbi/shims/gems/rails.rbi +55 -0
  141. data/sorbet/rbi/shims/gems/refract.rbi +13 -0
  142. data/sorbet/rbi/shims/gems/shoulda-context.rbi +16 -0
  143. data/sorbet/tapioca/compilers/phlex_controller.rb +80 -0
  144. data/sorbet/tapioca/config.yml +26 -0
  145. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  146. data/sorbet/tapioca/require.rb +4 -0
  147. metadata +266 -0
@@ -0,0 +1,9 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rackup` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rackup`.
6
+
7
+
8
+ # THIS IS AN EMPTY RBI FILE.
9
+ # see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
@@ -0,0 +1,517 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rails-dom-testing` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rails-dom-testing`.
6
+
7
+
8
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:3
9
+ module Rails; end
10
+
11
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:4
12
+ module Rails::Dom; end
13
+
14
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:5
15
+ module Rails::Dom::Testing
16
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:12
17
+ def default_html_version; end
18
+
19
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:12
20
+ def default_html_version=(val); end
21
+
22
+ class << self
23
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:12
24
+ def default_html_version; end
25
+
26
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:12
27
+ def default_html_version=(val); end
28
+
29
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:15
30
+ def html5_support?; end
31
+
32
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:19
33
+ def html_document(html_version: T.unsafe(nil)); end
34
+
35
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:26
36
+ def html_document_fragment(html_version: T.unsafe(nil)); end
37
+
38
+ private
39
+
40
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing.rb:34
41
+ def choose_html_parser(parser_classes, html_version: T.unsafe(nil)); end
42
+ end
43
+ end
44
+
45
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:6
46
+ module Rails::Dom::Testing::Assertions
47
+ include ::Rails::Dom::Testing::Assertions::DomAssertions
48
+ include ::Rails::Dom::Testing::Assertions::SelectorAssertions
49
+ end
50
+
51
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:7
52
+ module Rails::Dom::Testing::Assertions::DomAssertions
53
+ # \Test two HTML strings for equivalency (e.g., equal even when attributes are in another order)
54
+ #
55
+ # # assert that the referenced method generates the appropriate HTML string
56
+ # assert_dom_equal(
57
+ # '<a href="http://www.example.com">Apples</a>',
58
+ # link_to("Apples", "http://www.example.com"),
59
+ # )
60
+ #
61
+ # By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
62
+ # and newlines). If you want stricter matching with exact matching for whitespace, pass
63
+ # <tt>strict: true</tt>:
64
+ #
65
+ # # these assertions will both pass
66
+ # assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
67
+ # assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
68
+ #
69
+ # The DOMs are created using an HTML parser specified by
70
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
71
+ #
72
+ # When testing in a Rails application, the parser default can also be set by setting
73
+ # +Rails.application.config.dom_testing_default_html_version+.
74
+ #
75
+ # If you want to specify the HTML parser just for a particular assertion, pass
76
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
77
+ #
78
+ # assert_dom_equal expected, actual, html_version: :html5
79
+ #
80
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:35
81
+ def assert_dom_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
82
+
83
+ # The negated form of +assert_dom_equal+.
84
+ #
85
+ # # assert that the referenced method does not generate the specified HTML string
86
+ # assert_dom_not_equal(
87
+ # '<a href="http://www.example.com">Apples</a>',
88
+ # link_to("Oranges", "http://www.example.com"),
89
+ # )
90
+ #
91
+ # By default, the matcher will not pay attention to whitespace in text nodes (e.g., spaces
92
+ # and newlines). If you want stricter matching with exact matching for whitespace, pass
93
+ # <tt>strict: true</tt>:
94
+ #
95
+ # # these assertions will both pass
96
+ # assert_dom_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: false
97
+ # assert_dom_not_equal "<div>\nfoo\n\</div>", "<div>foo</div>", strict: true
98
+ #
99
+ # The DOMs are created using an HTML parser specified by
100
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
101
+ #
102
+ # When testing in a Rails application, the parser default can also be set by setting
103
+ # +Rails.application.config.dom_testing_default_html_version+.
104
+ #
105
+ # If you want to specify the HTML parser just for a particular assertion, pass
106
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
107
+ #
108
+ # assert_dom_not_equal expected, actual, html_version: :html5
109
+ #
110
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:68
111
+ def assert_dom_not_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
112
+
113
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:73
114
+ def refute_dom_equal(expected, actual, message = T.unsafe(nil), strict: T.unsafe(nil), html_version: T.unsafe(nil)); end
115
+
116
+ protected
117
+
118
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:76
119
+ def compare_doms(expected, actual, strict); end
120
+
121
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:129
122
+ def equal_attribute?(attr, other_attr); end
123
+
124
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:116
125
+ def equal_attribute_nodes?(nodes, other_nodes); end
126
+
127
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:108
128
+ def equal_child?(child, other_child, strict); end
129
+
130
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:96
131
+ def equal_children?(child, other_child, strict); end
132
+
133
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:88
134
+ def extract_children(node, strict); end
135
+
136
+ private
137
+
138
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/dom_assertions.rb:134
139
+ def fragment(text, html_version: T.unsafe(nil)); end
140
+ end
141
+
142
+ # Adds the +assert_dom+ method for use in Rails functional
143
+ # test cases, which can be used to make assertions on the response HTML of a controller
144
+ # action. You can also call +assert_dom+ within another +assert_dom+ to
145
+ # make assertions on elements selected by the enclosing assertion.
146
+ #
147
+ # Use +css_select+ to select elements without making an assertions, either
148
+ # from the response HTML or elements selected by the enclosing assertion.
149
+ #
150
+ # In addition to HTML responses, you can make the following assertions:
151
+ #
152
+ # * +assert_dom_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
153
+ # * +assert_dom_email+ - Assertions on the HTML body of an e-mail.
154
+ #
155
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:7
156
+ module Rails::Dom::Testing::Assertions::SelectorAssertions
157
+ # An assertion that selects elements and makes one or more equality tests.
158
+ #
159
+ # If the first argument is an element, selects all matching elements
160
+ # starting from (and including) that element and all its children in
161
+ # depth-first order.
162
+ #
163
+ # If no element is specified +assert_dom+ selects from
164
+ # the element returned in +document_root_element+
165
+ # unless +assert_dom+ is called from within an +assert_dom+ block.
166
+ # Override +document_root_element+ to tell +assert_dom+ what to select from.
167
+ # The default implementation raises an exception explaining this.
168
+ #
169
+ # When called with a block +assert_dom+ passes an array of selected elements
170
+ # to the block. Calling +assert_dom+ from the block, with no element specified,
171
+ # runs the assertion on the complete set of elements selected by the enclosing assertion.
172
+ # Alternatively the array may be iterated through so that +assert_dom+ can be called
173
+ # separately for each element.
174
+ #
175
+ #
176
+ # ==== Example
177
+ # If the response contains two ordered lists, each with four list elements then:
178
+ # assert_dom "ol" do |elements|
179
+ # elements.each do |element|
180
+ # assert_dom element, "li", 4
181
+ # end
182
+ # end
183
+ #
184
+ # will pass, as will:
185
+ # assert_dom "ol" do
186
+ # assert_dom "li", 8
187
+ # end
188
+ #
189
+ # The selector may be a CSS selector expression (String, Symbol, or Numeric) or an expression
190
+ # with substitution values (Array).
191
+ # Substitution uses a custom pseudo class match. Pass in whatever attribute you want to match (enclosed in quotes) and a ? for the substitution.
192
+ # assert_dom returns nil if called with an invalid css selector.
193
+ #
194
+ # assert_dom "div:match('id', ?)", "id_string"
195
+ # assert_dom "div:match('id', ?)", :id_string
196
+ # assert_dom "div:match('id', ?)", 1
197
+ # assert_dom "div:match('id', ?)", /\d+/
198
+ #
199
+ # === Equality Tests
200
+ #
201
+ # The equality test may be one of the following:
202
+ # * <tt>true</tt> - Assertion is true if at least one element selected.
203
+ # * <tt>false</tt> - Assertion is true if no element selected.
204
+ # * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
205
+ # one element matches the string or regular expression.
206
+ # * <tt>Integer</tt> - Assertion is true if exactly that number of
207
+ # elements are selected.
208
+ # * <tt>Range</tt> - Assertion is true if the number of selected
209
+ # elements fit the range.
210
+ # If no equality test specified, the assertion is true if at least one
211
+ # element selected.
212
+ #
213
+ # To perform more than one equality tests, use a hash with the following keys:
214
+ # * <tt>:text</tt> - Narrow the selection to elements that have this text
215
+ # value (string or regexp).
216
+ # * <tt>:html</tt> - Narrow the selection to elements that have this HTML
217
+ # content (string or regexp).
218
+ # * <tt>:count</tt> - Assertion is true if the number of selected elements
219
+ # is equal to this value.
220
+ # * <tt>:minimum</tt> - Assertion is true if the number of selected
221
+ # elements is at least this value.
222
+ # * <tt>:maximum</tt> - Assertion is true if the number of selected
223
+ # elements is at most this value.
224
+ #
225
+ # If the method is called with a block, once all equality tests are
226
+ # evaluated the block is called with an array of all matched elements.
227
+ #
228
+ # # At least one form element
229
+ # assert_dom "form"
230
+ #
231
+ # # Form element includes four input fields
232
+ # assert_dom "form input", 4
233
+ #
234
+ # # Page title is "Welcome"
235
+ # assert_dom "title", "Welcome"
236
+ #
237
+ # # Page title is "Welcome" and there is only one title element
238
+ # assert_dom "title", {count: 1, text: "Welcome"},
239
+ # "Wrong title or more than one title element"
240
+ #
241
+ # # Page contains no forms
242
+ # assert_dom "form", false, "This page must contain no forms"
243
+ #
244
+ # # Test the content and style
245
+ # assert_dom "body div.header ul.menu"
246
+ #
247
+ # # Use substitution values
248
+ # assert_dom "ol>li:match('id', ?)", /item-\d+/
249
+ #
250
+ # # All input fields in the form have a name
251
+ # assert_dom "form input" do
252
+ # assert_dom ":match('name', ?)", /.+/ # Not empty
253
+ # end
254
+ #
255
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:163
256
+ def assert_dom(*args, &block); end
257
+
258
+ # Extracts the body of an email and runs nested assertions on it.
259
+ #
260
+ # You must enable deliveries for this assertion to work, use:
261
+ # ActionMailer::Base.perform_deliveries = true
262
+ #
263
+ # Example usage:
264
+ #
265
+ # assert_dom_email do
266
+ # assert_dom "h1", "Email alert"
267
+ # end
268
+ #
269
+ # assert_dom_email do
270
+ # items = assert_dom "ol>li"
271
+ # items.each do
272
+ # # Work with items here...
273
+ # end
274
+ # end
275
+ #
276
+ # The DOM is created using an HTML parser specified by
277
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
278
+ #
279
+ # When testing in a Rails application, the parser default can also be set by setting
280
+ # +Rails.application.config.dom_testing_default_html_version+.
281
+ #
282
+ # If you want to specify the HTML parser just for a particular assertion, pass
283
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
284
+ #
285
+ # assert_dom_email(html_version: :html5) do
286
+ # assert_dom "h1", "Email alert"
287
+ # end
288
+ #
289
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:318
290
+ def assert_dom_email(html_version: T.unsafe(nil), &block); end
291
+
292
+ # Extracts the content of an element, treats it as encoded HTML and runs
293
+ # nested assertion on it.
294
+ #
295
+ # You typically call this method within another assertion to operate on
296
+ # all currently selected elements. You can also pass an element or array
297
+ # of elements.
298
+ #
299
+ # The content of each element is un-encoded, and wrapped in the root
300
+ # element +encoded+. It then calls the block with all un-encoded elements.
301
+ #
302
+ # # Selects all bold tags from within the title of an Atom feed's entries (perhaps to nab a section name prefix)
303
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
304
+ # # Select each entry item and then the title item
305
+ # assert_dom "entry>title" do
306
+ # # Run assertions on the encoded title elements
307
+ # assert_dom_encoded do
308
+ # assert_dom "b"
309
+ # end
310
+ # end
311
+ # end
312
+ #
313
+ #
314
+ # # Selects all paragraph tags from within the description of an RSS feed
315
+ # assert_dom "rss[version=2.0]" do
316
+ # # Select description element of each feed item.
317
+ # assert_dom "channel>item>description" do
318
+ # # Run assertions on the encoded elements.
319
+ # assert_dom_encoded do
320
+ # assert_dom "p"
321
+ # end
322
+ # end
323
+ # end
324
+ #
325
+ # The DOM is created using an HTML parser specified by
326
+ # Rails::Dom::Testing.default_html_version (either :html4 or :html5).
327
+ #
328
+ # When testing in a Rails application, the parser default can also be set by setting
329
+ # +Rails.application.config.dom_testing_default_html_version+.
330
+ #
331
+ # If you want to specify the HTML parser just for a particular assertion, pass
332
+ # <tt>html_version: :html4</tt> or <tt>html_version: :html5</tt> keyword arguments:
333
+ #
334
+ # assert_dom "feed[xmlns='http://www.w3.org/2005/Atom']" do
335
+ # assert_dom "entry>title" do
336
+ # assert_dom_encoded(html_version: :html5) do
337
+ # assert_dom "b"
338
+ # end
339
+ # end
340
+ # end
341
+ #
342
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:265
343
+ def assert_dom_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
344
+
345
+ # The negated form of +assert_dom+.
346
+ #
347
+ # === Equality Tests
348
+ #
349
+ # Supports the same equality tests as +assert_dom+ except for:
350
+ # * <tt>true</tt>
351
+ # * <tt>false</tt>
352
+ # * <tt>Integer</tt>
353
+ # * <tt>Range</tt>
354
+ # * <tt>:count</tt>
355
+ # * <tt>:minimum</tt>
356
+ # * <tt>:maximum</tt>
357
+ #
358
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:183
359
+ def assert_not_dom(*args, &block); end
360
+
361
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:190
362
+ def assert_not_select(*args, &block); end
363
+
364
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:169
365
+ def assert_select(*args, &block); end
366
+
367
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:331
368
+ def assert_select_email(html_version: T.unsafe(nil), &block); end
369
+
370
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:285
371
+ def assert_select_encoded(element = T.unsafe(nil), html_version: T.unsafe(nil), &block); end
372
+
373
+ # Select and return all matching elements.
374
+ #
375
+ # If called with a single argument, uses that argument as a selector.
376
+ # Called without an element +css_select+ selects from
377
+ # the element returned in +document_root_element+
378
+ #
379
+ # The default implementation of +document_root_element+ raises an exception explaining this.
380
+ #
381
+ # Returns an empty Nokogiri::XML::NodeSet if no match is found.
382
+ #
383
+ # If called with two arguments, uses the first argument as the root
384
+ # element and the second argument as the selector. Attempts to match the
385
+ # root element and any of its children.
386
+ # Returns an empty Nokogiri::XML::NodeSet if no match is found.
387
+ #
388
+ # The selector may be a CSS selector expression (String).
389
+ # css_select returns nil if called with an invalid css selector.
390
+ #
391
+ # # Selects all div tags
392
+ # divs = css_select("div")
393
+ #
394
+ # # Selects all paragraph tags and does something interesting
395
+ # pars = css_select("p")
396
+ # pars.each do |par|
397
+ # # Do something fun with paragraphs here...
398
+ # end
399
+ #
400
+ # # Selects all list items in unordered lists
401
+ # items = css_select("ul>li")
402
+ #
403
+ # # Selects all form tags and then all inputs inside the form
404
+ # forms = css_select("form")
405
+ # forms.each do |form|
406
+ # inputs = css_select(form, "input")
407
+ # ...
408
+ # end
409
+ #
410
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:58
411
+ def css_select(*args); end
412
+
413
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:189
414
+ def refute_dom(*args, &block); end
415
+
416
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:191
417
+ def refute_select(*args, &block); end
418
+
419
+ private
420
+
421
+ # +equals+ must contain :minimum, :maximum and :count keys
422
+ #
423
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:340
424
+ def assert_size_match!(size, equals, css_selector, message = T.unsafe(nil)); end
425
+
426
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:352
427
+ def count_description(min, max, count); end
428
+
429
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:334
430
+ def document_root_element; end
431
+
432
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:193
433
+ def dom_assertions(selector, &block); end
434
+
435
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:368
436
+ def nest_selection(selection); end
437
+
438
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:377
439
+ def nodeset(node); end
440
+
441
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions.rb:364
442
+ def pluralize_element(quantity); end
443
+ end
444
+
445
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:12
446
+ class Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector
447
+ include ::Minitest::Assertions
448
+
449
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:17
450
+ def initialize(values, previous_selection = T.unsafe(nil), refute: T.unsafe(nil), &root_fallback); end
451
+
452
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:46
453
+ def context; end
454
+
455
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:13
456
+ def css_selector; end
457
+
458
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:13
459
+ def message; end
460
+
461
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:39
462
+ def select; end
463
+
464
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:33
465
+ def selecting_no_body?; end
466
+
467
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:13
468
+ def tests; end
469
+
470
+ private
471
+
472
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:146
473
+ def collapse_html_whitespace!(text); end
474
+
475
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:102
476
+ def extract_equality_tests(refute); end
477
+
478
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:74
479
+ def extract_root(previous_selection, root_fallback); end
480
+
481
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:91
482
+ def extract_selectors; end
483
+
484
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:48
485
+ def filter(matches); end
486
+
487
+ class << self
488
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:46
489
+ def context; end
490
+ end
491
+ end
492
+
493
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:44
494
+ Rails::Dom::Testing::Assertions::SelectorAssertions::HTMLSelector::NO_STRIP = T.let(T.unsafe(nil), Array)
495
+
496
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:8
497
+ class Rails::Dom::Testing::Assertions::SelectorAssertions::SubstitutionContext
498
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:9
499
+ def initialize; end
500
+
501
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:20
502
+ def match(matches, attribute, matcher); end
503
+
504
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:13
505
+ def substitute!(selector, values, format_for_presentation = T.unsafe(nil)); end
506
+
507
+ private
508
+
509
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:25
510
+ def matcher_for(value, format_for_presentation); end
511
+
512
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/assertions/selector_assertions/substitution_context.rb:36
513
+ def substitutable?(value); end
514
+ end
515
+
516
+ # pkg:gem/rails-dom-testing#lib/rails/dom/testing/railtie.rb:6
517
+ class Rails::Dom::Testing::Railtie < ::Rails::Railtie; end