Merge pull request #1179 from sveltejs/fix-capitalize-warning

fix capitalize warning
pull/7738/head
Rich Harris 9 years ago committed by GitHub
commit 704bdd9fa8

@ -101,7 +101,7 @@ export default function validate(
throw error;
}
if (name && !/^[A-Z]/.test(name)) {
if (name && /^[a-z]/.test(name)) {
const message = `options.name should be capitalised`;
onwarn({
message,

@ -88,4 +88,19 @@ describe("validate", () => {
}
]);
});
it("does not warn if options.name begins with non-alphabetic character", () => {
const warnings = [];
svelte.compile("<div></div>", {
name: "_",
onwarn(warning) {
warnings.push({
message: warning.message,
pos: warning.pos,
loc: warning.loc
});
}
});
assert.deepEqual(warnings, []);
});
});

Loading…
Cancel
Save