Fix some formatting and indenting inconsistiencies

pull/8386/head
Nguyen Tran 4 years ago
parent 8b2ad778f1
commit 3eb16eba24

@ -194,7 +194,7 @@ export function unpack_destructuring({
number_of_computed_props number_of_computed_props
}); });
} }
} }
}); });
} }
} }

@ -1,20 +1,20 @@
export default { export default {
html: ` html: `
<p>4, 12, 60</p> <p>4, 12, 60</p>
`, `,
async test({ component, target, assert }) { async test({ component, target, assert }) {
component.permutation = [2, 3, 1]; component.permutation = [2, 3, 1];
await (component.promise1 = Promise.resolve({length: 1, width: 2, height: 3})); await (component.promise1 = Promise.resolve({length: 1, width: 2, height: 3}));
try { try {
await (component.promise2 = Promise.reject({length: 97, width: 98, height: 99})); await (component.promise2 = Promise.reject({length: 97, width: 98, height: 99}));
} catch (e) { } catch (e) {
// nothing // nothing
} }
assert.htmlEqual(target.innerHTML, ` assert.htmlEqual(target.innerHTML, `
<p>2, 11, 2</p> <p>2, 11, 2</p>
<p>9506, 28811, 98</p> <p>9506, 28811, 98</p>
`); `);
} }
}; };

@ -1,25 +1,25 @@
<script> <script>
export let promise1 = {length: 5, width: 3, height: 4}; export let promise1 = {length: 5, width: 3, height: 4};
export let promise2 = {length: 12, width: 5, height: 13}; export let promise2 = {length: 12, width: 5, height: 13};
export let permutation = [1, 2, 3]; export let permutation = [1, 2, 3];
function calculate(length, width, height) { function calculate(length, width, height) {
return { return {
'1-Dimensions': [length, width, height], '1-Dimensions': [length, width, height],
'2-Dimensions': [length * width, width * height, length * height], '2-Dimensions': [length * width, width * height, length * height],
'3-Dimensions': [length * width * height, length + width + height, length * width + width * height + length * height] '3-Dimensions': [length * width * height, length + width + height, length * width + width * height + length * height]
}; };
} }
</script> </script>
{#await promise1 then { length, width, height }} {#await promise1 then { length, width, height }}
{@const [a, b, c] = permutation} {@const [a, b, c] = permutation}
{@const { [`${a}-Dimensions`]: { [c - 1]: first }, [`${b}-Dimensions`]: { [b - 1]: second }, [`${c}-Dimensions`]: { [a - 1]: third } } = calculate(length, width, height) } {@const { [`${a}-Dimensions`]: { [c - 1]: first }, [`${b}-Dimensions`]: { [b - 1]: second }, [`${c}-Dimensions`]: { [a - 1]: third } } = calculate(length, width, height) }
<p>{first}, {second}, {third}</p> <p>{first}, {second}, {third}</p>
{/await} {/await}
{#await promise2 catch { length, width, height }} {#await promise2 catch { length, width, height }}
{@const [a, b, c] = permutation} {@const [a, b, c] = permutation}
{@const { [`${a}-Dimensions`]: { [c - 1]: first }, [`${b}-Dimensions`]: { [b - 1]: second }, [`${c}-Dimensions`]: { [a - 1]: third } } = calculate(length, width, height) } {@const { [`${a}-Dimensions`]: { [c - 1]: first }, [`${b}-Dimensions`]: { [b - 1]: second }, [`${c}-Dimensions`]: { [a - 1]: third } } = calculate(length, width, height) }
<p>{first}, {second}, {third}</p> <p>{first}, {second}, {third}</p>
{/await} {/await}

@ -6,10 +6,10 @@ export default {
`, `,
async test({ component, target, assert }) { async test({ component, target, assert }) {
component.boxes = [{ length: 10, width: 20, height: 30 }]; component.boxes = [{ length: 10, width: 20, height: 30 }];
assert.htmlEqual(target.innerHTML, assert.htmlEqual(target.innerHTML,
'<button>200, 600, 300, 6000</button>' '<button>200, 600, 300, 6000</button>'
); );
} }
}; };

@ -7,36 +7,36 @@
function calculate(length, width, height) { function calculate(length, width, height) {
return { return {
twoDimensions: { twoDimensions: {
bottomArea: length * width, bottomArea: length * width,
sideArea1: width * height, sideArea1: width * height,
sideArea2: length * height sideArea2: length * height
}, },
threeDimensions: { threeDimensions: {
volume: length * width * height volume: length * width * height
} }
}; };
} }
export let dimension = 'Dimensions'; export let dimension = 'Dimensions';
function changeDimension() { function changeDimension() {
dimension = 'DIMENSIONS'; dimension = 'DIMENSIONS';
} }
let area = 'Area'; let area = 'Area';
</script> </script>
{#each boxes as { length, width, height }} {#each boxes as { length, width, height }}
{@const { {@const {
[`two${dimension}`]: { [`two${dimension}`]: {
i = 1, i = 1,
[`bottom${area}`]: bottom, [`bottom${area}`]: bottom,
[`side${area}${i++}`]: sideone, [`side${area}${i++}`]: sideone,
[`side${area}${i++}`]: sidetwo [`side${area}${i++}`]: sidetwo
}, },
[`three${dimension}`]: { [`three${dimension}`]: {
volume volume
} }
} = calculate(length, width, height)} } = calculate(length, width, height)}
<button on:click={changeDimension}>{bottom}, {sideone}, {sidetwo}, {volume}</button> <button on:click={changeDimension}>{bottom}, {sideone}, {sidetwo}, {volume}</button>
{/each} {/each}

@ -1,10 +1,10 @@
export default { export default {
props: { props: {
array: [ array: [
[1, 2, 3, 4, 5], [1, 2, 3, 4, 5],
[6, 7, 8], [6, 7, 8],
[9, 10, 11, 12], [9, 10, 11, 12],
[13, 14, 15, 16, 17, 18, 19, 20, 21, 22] [13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
] ]
}, },

@ -1,11 +1,11 @@
export default { export default {
props: { props: {
firstString: 'cats', firstString: 'cats',
secondString: 'dogs', secondString: 'dogs',
objectsArray: [ objectsArray: [
{ dogs: 'woof', cats: 'meow', stac: 'stack', DOGS: 'WOOF' }, { dogs: 'woof', cats: 'meow', stac: 'stack', DOGS: 'WOOF' },
{ dogs: 'A German sheppard', cats: 'A tailless cat', stac: 'A jenga tower', DOGS: 'A GERMAN SHEPPARD' }, { dogs: 'A German sheppard', cats: 'A tailless cat', stac: 'A jenga tower', DOGS: 'A GERMAN SHEPPARD' },
{ dogs: 'dogs', cats: 'cats', stac: 'stac', DOGS: 'DOGS' } { dogs: 'dogs', cats: 'cats', stac: 'stac', DOGS: 'DOGS' }
] ]
}, },

@ -1,7 +1,7 @@
<script> <script>
export let objectsArray; export let objectsArray;
export let firstString; export let firstString;
export let secondString; export let secondString;
</script> </script>
{#each objectsArray as { [firstString]: firstProp, [secondString]: secondProp, [firstString.split('').reverse().join('')]: reverseFirst, [secondString.toUpperCase()]: upperSecond } } {#each objectsArray as { [firstString]: firstProp, [secondString]: secondProp, [firstString.split('').reverse().join('')]: reverseFirst, [secondString.toUpperCase()]: upperSecond } }

Loading…
Cancel
Save