sqlite-hub 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,6 +60,30 @@ test("markdown preview escapes raw html content", async () => {
60
60
  assert.match(html, /<script>/);
61
61
  });
62
62
 
63
+ test("markdown preview keeps JSON code block quotes readable", async () => {
64
+ const { renderMarkdownPreview } = await loadMarkdownModule();
65
+ const previousMarked = globalThis.marked;
66
+ let parsedSource = "";
67
+
68
+ globalThis.marked = {
69
+ parse: source => {
70
+ parsedSource = source;
71
+ return `<pre><code>${source}</code></pre>`;
72
+ },
73
+ };
74
+
75
+ try {
76
+ const html = renderMarkdownPreview(['<img src=x onerror="alert(1)">', '', '```json', '{"id":"abc"}', '```'].join("\n"));
77
+
78
+ assert.match(parsedSource, /&lt;img/);
79
+ assert.match(parsedSource, /"id":"abc"/);
80
+ assert.doesNotMatch(parsedSource, /&quot;id&quot;/);
81
+ assert.match(html, /"id":"abc"/);
82
+ } finally {
83
+ globalThis.marked = previousMarked;
84
+ }
85
+ });
86
+
63
87
  test("markdown preview strips executable link targets from rendered markdown", async () => {
64
88
  const { renderMarkdownPreview } = await loadMarkdownModule();
65
89
  const previousMarked = globalThis.marked;
@@ -106,6 +106,35 @@ test("row editor delete button renders a trash icon", async () => {
106
106
  assert.match(html, /<span class="material-symbols-outlined text-sm">delete<\/span>\s*Delete Row/);
107
107
  });
108
108
 
109
+ test("row editor JSON actions render as an export dropdown", async () => {
110
+ const { renderRowEditorPanel } = await loadFrontendModule(
111
+ "../frontend/js/components/rowEditorPanel.js"
112
+ );
113
+ const html = renderRowEditorPanel({
114
+ title: "Values",
115
+ closeAction: "close",
116
+ formName: "save-data-row",
117
+ jsonActionsEnabled: true,
118
+ editableFields: [
119
+ {
120
+ name: "title",
121
+ label: "title",
122
+ value: "Acme",
123
+ },
124
+ ],
125
+ });
126
+
127
+ assert.match(html, /data-dropdown-button/);
128
+ assert.match(html, /Export/);
129
+ assert.match(html, /data-action="copy-row-editor-json"/);
130
+ assert.match(html, /Copy to clipboard/);
131
+ assert.match(html, /data-action="export-row-editor-json"/);
132
+ assert.match(html, /JSON file/);
133
+ assert.match(html, /data-action="insert-row-editor-json-into-document"/);
134
+ assert.match(html, /Markdown document/);
135
+ assert.doesNotMatch(html, /Copy as JSON|Export as JSON/);
136
+ });
137
+
109
138
  test("data updates can change NULL to empty string and empty string to NULL", () => {
110
139
  const db = new Database(":memory:");
111
140
 
@@ -100,6 +100,7 @@ test("settings view scopes API token controls to the active database", async ()
100
100
  assert.match(rendered.main, /name="name"/);
101
101
  assert.match(rendered.main, /type="submit"/);
102
102
  assert.match(rendered.main, /data-action="open-delete-api-token-modal"/);
103
+ assert.match(rendered.main, /<span class="material-symbols-outlined text-sm">delete<\/span>\s*Delete/);
103
104
  assert.match(rendered.main, /bg-surface-container-lowest/);
104
105
  assert.doesNotMatch(rendered.main, /sqlite-hub --port:PORT/);
105
106
  assert.doesNotMatch(rendered.main, /Open Github/);
@@ -46,6 +46,10 @@ test("structure toolbar groups graph format actions in a dropdown", async () =>
46
46
  const { main } = renderStructureView(buildStructureState());
47
47
 
48
48
  assert.match(main, /data-dropdown-button/);
49
+ assert.match(main, /Open companies/);
50
+ assert.match(main, /data-to="\/data\/companies"/);
51
+ assert.match(main, /data-to="\/table-designer\/companies"/);
52
+ assert.match(main, /data-action="open-table-in-sql-editor"/);
49
53
  assert.match(main, /Format graph/);
50
54
  assert.match(main, /Fit Graph/);
51
55
  assert.match(main, /data-structure-graph-action="fit"/);