Bug 1416916 - Syntax highlight .es# files r=jlast

Differential Revision: https://phabricator.services.mozilla.com/D34191

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Walsh 2019-06-10 15:57:22 +00:00
parent 4840805457
commit c42d65aba2
2 changed files with 13 additions and 3 deletions

View File

@ -367,9 +367,9 @@ export function getMode(
}
}
// if the url ends with .marko we set the name to Javascript so
// syntax highlighting works for marko too
if (url && url.match(/\.marko$/i)) {
// if the url ends with .marko or .es6 we set the name to Javascript so
// syntax highlighting works for these file extensions too
if (url && url.match(/\.marko|\.es6$/i)) {
return { name: "javascript" };
}

View File

@ -461,6 +461,16 @@ describe("sources", () => {
);
expect(getMode(source, content)).toEqual({ name: "javascript" });
});
it("es6", () => {
const { source, content } = makeMockSourceAndContent(
"http://localhost.com:7999/increment/sometestfile.es6",
undefined,
"does not matter",
"function foo(){}"
);
expect(getMode(source, content)).toEqual({ name: "javascript" });
});
});
describe("getSourceLineCount", () => {