|
191 | 191 | )
|
192 | 192 | end
|
193 | 193 | end
|
| 194 | + |
| 195 | + context 'with only props that target transformed data' do |
| 196 | + let(:headers) do |
| 197 | + { |
| 198 | + 'X-Inertia' => true, |
| 199 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 200 | + 'X-Inertia-Partial-Data' => 'nested.evaluated.first', |
| 201 | + } |
| 202 | + end |
| 203 | + |
| 204 | + before { get deeply_nested_props_path, headers: headers } |
| 205 | + |
| 206 | + it 'filters out the entire evaluated prop' do |
| 207 | + expect(response.parsed_body['props']).to eq( |
| 208 | + 'always' => 'always prop', |
| 209 | + 'nested' => { |
| 210 | + 'deeply_nested' => { |
| 211 | + 'deeply_nested_always' => 'deeply nested always prop', |
| 212 | + }, |
| 213 | + }, |
| 214 | + ) |
| 215 | + end |
| 216 | + end |
| 217 | + |
| 218 | + context 'with except props that target transformed data' do |
| 219 | + let(:headers) do |
| 220 | + { |
| 221 | + 'X-Inertia' => true, |
| 222 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 223 | + 'X-Inertia-Partial-Except' => 'nested.evaluated.first', |
| 224 | + } |
| 225 | + end |
| 226 | + |
| 227 | + before { get deeply_nested_props_path, headers: headers } |
| 228 | + |
| 229 | + it 'renders the entire evaluated prop' do |
| 230 | + expect(response.parsed_body['props']).to eq( |
| 231 | + 'always' => 'always prop', |
| 232 | + 'flat' => 'flat param', |
| 233 | + 'lazy' => 'lazy param', |
| 234 | + 'nested_lazy' => { 'first' => 'first nested lazy param' }, |
| 235 | + 'nested' => { |
| 236 | + 'first' => 'first nested param', |
| 237 | + 'second' => 'second nested param', |
| 238 | + 'evaluated' => { |
| 239 | + 'first' => 'first evaluated nested param', |
| 240 | + 'second' => 'second evaluated nested param', |
| 241 | + }, |
| 242 | + 'deeply_nested' => { |
| 243 | + 'first' => 'first deeply nested param', |
| 244 | + 'second' => false, |
| 245 | + 'what_about_nil' => nil, |
| 246 | + 'what_about_empty_hash' => {}, |
| 247 | + 'deeply_nested_always' => 'deeply nested always prop', |
| 248 | + 'deeply_nested_lazy' => 'deeply nested lazy prop', |
| 249 | + }, |
| 250 | + }, |
| 251 | + ) |
| 252 | + end |
| 253 | + end |
194 | 254 | end
|
195 | 255 |
|
196 | 256 | context 'partial except rendering' do
|
|
0 commit comments