|
113 | 113 | end
|
114 | 114 | end
|
115 | 115 |
|
| 116 | + context 'partial except rendering' do |
| 117 | + let(:headers) do |
| 118 | + { |
| 119 | + 'X-Inertia' => true, |
| 120 | + 'X-Inertia-Partial-Data' => 'nested,nested_lazy', |
| 121 | + 'X-Inertia-Partial-Except' => 'nested', |
| 122 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 123 | + } |
| 124 | + end |
| 125 | + |
| 126 | + before { get except_props_path, headers: headers } |
| 127 | + |
| 128 | + it 'returns listed props without excepted' do |
| 129 | + expect(response.parsed_body['props']).to eq( |
| 130 | + 'always' => 'always prop', |
| 131 | + 'nested_lazy' => { 'first' => 'first nested lazy param' }, |
| 132 | + ) |
| 133 | + end |
| 134 | + |
| 135 | + context 'when except always prop' do |
| 136 | + let(:headers) {{ |
| 137 | + 'X-Inertia' => true, |
| 138 | + 'X-Inertia-Partial-Data' => 'nested_lazy', |
| 139 | + 'X-Inertia-Partial-Except' => 'always_prop', |
| 140 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 141 | + }} |
| 142 | + |
| 143 | + it 'returns always prop anyway' do |
| 144 | + expect(response.parsed_body['props']).to eq( |
| 145 | + 'always' => 'always prop', |
| 146 | + 'nested_lazy' => { 'first' => 'first nested lazy param' }, |
| 147 | + ) |
| 148 | + end |
| 149 | + end |
| 150 | + |
| 151 | + context 'when except unknown prop' do |
| 152 | + let(:headers) do |
| 153 | + { |
| 154 | + 'X-Inertia' => true, |
| 155 | + 'X-Inertia-Partial-Data' => 'nested_lazy', |
| 156 | + 'X-Inertia-Partial-Except' => 'unknown', |
| 157 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 158 | + } |
| 159 | + end |
| 160 | + |
| 161 | + it 'returns props' do |
| 162 | + expect(response.parsed_body['props']).to eq( |
| 163 | + 'always' => 'always prop', |
| 164 | + 'nested_lazy' => { 'first' => 'first nested lazy param' }, |
| 165 | + ) |
| 166 | + end |
| 167 | + end |
| 168 | + |
| 169 | + context 'when excludes with dot notation' do |
| 170 | + let(:headers) do |
| 171 | + { |
| 172 | + 'X-Inertia' => true, |
| 173 | + 'X-Inertia-Partial-Data' => 'nested,nested_lazy', |
| 174 | + 'X-Inertia-Partial-Except' => 'nested.first,nested_lazy.first', |
| 175 | + 'X-Inertia-Partial-Component' => 'TestComponent', |
| 176 | + } |
| 177 | + end |
| 178 | + |
| 179 | + it 'works with dot notation only with simple props' do |
| 180 | + expect(response.parsed_body['props']).to eq( |
| 181 | + 'always' => 'always prop', |
| 182 | + 'nested' => { 'second' => 'second nested param' }, |
| 183 | + 'nested_lazy' => { 'first' => 'first nested lazy param' }, |
| 184 | + ) |
| 185 | + end |
| 186 | + end |
| 187 | + end |
| 188 | + |
116 | 189 | context 'lazy prop rendering' do
|
117 | 190 | context 'on first load' do
|
118 | 191 | let(:page) {
|
|
0 commit comments