Skip to content

Commit 1579c50

Browse files
committed
test binding values work with sourcemaps
1 parent 37eee74 commit 1579c50

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Widget bind:potato/>
2+
3+
<script>
4+
import Widget from 'wherever';
5+
6+
export default {
7+
components: {
8+
Widget
9+
}
10+
};
11+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export function test ({ assert, smc, locateInSource, locateInGenerated }) {
2+
const expected = locateInSource( 'potato' );
3+
4+
let loc;
5+
let actual;
6+
7+
loc = locateInGenerated( 'potato' );
8+
9+
actual = smc.originalPositionFor({
10+
line: loc.line + 1,
11+
column: loc.column
12+
});
13+
14+
assert.deepEqual( actual, {
15+
source: 'input.html',
16+
name: null,
17+
line: expected.line + 1,
18+
column: expected.column
19+
});
20+
21+
loc = locateInGenerated( 'potato', loc.character + 1 );
22+
23+
actual = smc.originalPositionFor({
24+
line: loc.line + 1,
25+
column: loc.column
26+
});
27+
28+
assert.deepEqual( actual, {
29+
source: 'input.html',
30+
name: null,
31+
line: expected.line + 1,
32+
column: expected.column
33+
});
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<input bind:value='foo.bar.baz'>

test/sourcemaps/samples/binding/solox

Whitespace-only changes.
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export function test ({ assert, smc, locateInSource, locateInGenerated }) {
2+
const expected = locateInSource( 'foo.bar.baz' );
3+
4+
let loc;
5+
let actual;
6+
7+
loc = locateInGenerated( 'foo.bar.baz' );
8+
9+
actual = smc.originalPositionFor({
10+
line: loc.line + 1,
11+
column: loc.column
12+
});
13+
14+
assert.deepEqual( actual, {
15+
source: 'input.html',
16+
name: null,
17+
line: expected.line + 1,
18+
column: expected.column
19+
});
20+
21+
loc = locateInGenerated( 'foo.bar.baz', loc.character + 1 );
22+
23+
actual = smc.originalPositionFor({
24+
line: loc.line + 1,
25+
column: loc.column
26+
});
27+
28+
assert.deepEqual( actual, {
29+
source: 'input.html',
30+
name: null,
31+
line: expected.line + 1,
32+
column: expected.column
33+
});
34+
}

0 commit comments

Comments
 (0)