Skip to content

Commit 8f0851b

Browse files
committed
fix(webui): improve displaying header controls in source view component
test(javascript): add test for shared values
1 parent ce206fc commit 8f0851b

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

js/mokapi/shared_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,21 @@ func TestModule_Shared(t *testing.T) {
343343
r.Equal(t, "bar", mokapi.Export(v))
344344
},
345345
},
346+
{
347+
name: "delete field in object",
348+
test: func(t *testing.T, newVm func() *goja.Runtime) {
349+
vm1 := newVm()
350+
351+
v, err := vm1.RunString(`
352+
const m = require('mokapi');
353+
const shared = m.shared.update('foo', (v) => v ?? { foo: 'bar' });
354+
delete shared.foo
355+
shared
356+
`)
357+
r.NoError(t, err)
358+
r.Equal(t, map[string]any{}, mokapi.Export(v))
359+
},
360+
},
346361
{
347362
name: "push array",
348363
test: func(t *testing.T, newVm func() *goja.Runtime) {

webui/src/components/dashboard/SourceView.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ watch(
297297
place-content: center;
298298
border-right: 1px solid var(--source-border);
299299
}
300+
.source-view .header .controls > a {
301+
font-size: 0.9rem;
302+
border-right: 1px solid var(--source-border);
303+
border-top-left-radius: 6px;
304+
border-bottom-left-radius: 6px;
305+
}
300306
.source-view .header button.active {
301307
background-color: black !important;
302308
outline: 1px solid var(--source-border);

0 commit comments

Comments
 (0)