fix(tooling): reconcile framework fixes in canonical WireJS checkout
This commit is contained in:
1 parent
a077515336
commit
65d63dfbe7
19 files changed
+312
-156
No files matched your search
@@ -29,8 +29,8 @@ test("formats large typed JSON prop defaults with the bundled formatter", () =>
|
||||
}`;
|
||||
const formatted = formatWrn(source, { insertSpaces: true, tabSize: 2, printWidth: 70 });
|
||||
|
||||
assert.match(formatted, /categories: unknown\[\] = \[\n \{/);
|
||||
assert.match(formatted, /"apps": \[\n \{/);
|
||||
assert.match(formatted, /categories: unknown\[\] = \[\n {6}\{/);
|
||||
assert.match(formatted, /"apps": \[\n {10}\{/);
|
||||
assert.equal(formatWrn(formatted, { insertSpaces: true, tabSize: 2, printWidth: 70 }), formatted);
|
||||
});
|
||||
|
||||
|
||||
@@ -41,6 +41,51 @@ function run(messages) {
|
||||
return parseResponses(result.stdout || Buffer.alloc(0));
|
||||
}
|
||||
|
||||
test("bundled language server accepts translated attributes and form statement handlers", () => {
|
||||
const uri = "file:///tmp/wrnexus-translated-contact.wrn";
|
||||
const valid = `page Contact {
|
||||
view {
|
||||
<div data-component="PageHeader" eyebrow="{t:contact.eyebrow}" title="{t:contact.title}" description="{t:contact.description}"></div>
|
||||
<form @wrn:success="event.currentTarget.reset(); toast.success('Sent')"></form>
|
||||
}
|
||||
}`;
|
||||
const responses = run([
|
||||
{ jsonrpc: "2.0", id: 1, method: "initialize", params: { rootPath: root } },
|
||||
{ jsonrpc: "2.0", method: "initialized", params: {} },
|
||||
{
|
||||
jsonrpc: "2.0",
|
||||
method: "textDocument/didOpen",
|
||||
params: { textDocument: { uri, languageId: "wrn", version: 1, text: valid } },
|
||||
},
|
||||
{
|
||||
jsonrpc: "2.0",
|
||||
method: "textDocument/didChange",
|
||||
params: {
|
||||
textDocument: { uri, version: 2 },
|
||||
contentChanges: [
|
||||
{ text: valid.replace("{t:contact.title}", "{t:contact.title} {missingValue}") },
|
||||
],
|
||||
},
|
||||
},
|
||||
{ jsonrpc: "2.0", method: "textDocument/didSave", params: { textDocument: { uri } } },
|
||||
{ jsonrpc: "2.0", id: 2, method: "shutdown", params: {} },
|
||||
{ jsonrpc: "2.0", method: "exit", params: {} },
|
||||
]);
|
||||
const publications = responses.filter(
|
||||
(item) => item.method === "textDocument/publishDiagnostics",
|
||||
);
|
||||
assert.equal(publications.length, 2);
|
||||
assert.deepEqual(
|
||||
publications[0].params.diagnostics.filter((item) => item.source === "wrnexus-types"),
|
||||
[],
|
||||
);
|
||||
const errors = publications[1].params.diagnostics.filter(
|
||||
(item) => item.source === "wrnexus-types",
|
||||
);
|
||||
assert.equal(errors.length, 1);
|
||||
assert.match(errors[0].message, /missingValue/);
|
||||
});
|
||||
|
||||
test("language server starts under Node and keeps official typed components clean", () => {
|
||||
const files = [
|
||||
path.join(root, "packages", "ui", "components", "AuthForm.wrn"),
|
||||
|
||||
Reference in new issue
Block a user