mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Merge pull request #314 from sveltejs/fix-child-segment
fix child.segment bug
This commit is contained in:
@@ -233,7 +233,7 @@ function prepare_page(target: Target): Promise<{
|
||||
path,
|
||||
preloading: false,
|
||||
child: Object.assign({}, root_props.child, {
|
||||
segment: new_segments[0]
|
||||
segment: segments[0]
|
||||
})
|
||||
};
|
||||
if (changed(query, root_props.query)) data.query = query;
|
||||
@@ -260,12 +260,11 @@ function prepare_page(target: Target): Promise<{
|
||||
params: get_params(target.match),
|
||||
}, results[i].preloaded);
|
||||
|
||||
level.props.child = {
|
||||
segment: new_segments[i + 1]
|
||||
};
|
||||
level.props.child = {};
|
||||
}
|
||||
|
||||
level = level.props.child;
|
||||
level.segment = segments[i + 1];
|
||||
}
|
||||
|
||||
return { data, nullable_depth };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<span>y: {segment} {count}</span>
|
||||
<svelte:component this={child.component} {...child.props}/>
|
||||
|
||||
<span>child segment: {child.segment}</span>
|
||||
|
||||
<script>
|
||||
import counts from '../_counts.js';
|
||||
|
||||
|
||||
@@ -630,7 +630,8 @@ function run({ mode, basepath = '' }) {
|
||||
.then(text => {
|
||||
assert.deepEqual(text.split('\n').filter(Boolean), [
|
||||
'y: bar 1',
|
||||
'z: baz 1'
|
||||
'z: baz 1',
|
||||
'child segment: baz'
|
||||
]);
|
||||
|
||||
return nightmare.click(`a`)
|
||||
@@ -642,7 +643,8 @@ function run({ mode, basepath = '' }) {
|
||||
.then(text => {
|
||||
assert.deepEqual(text.split('\n').filter(Boolean), [
|
||||
'y: bar 1',
|
||||
'z: qux 2'
|
||||
'z: qux 2',
|
||||
'child segment: qux'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user