mirror of
https://github.com/lana-k/sqliteviz.git
synced 2026-05-06 20:09:18 +08:00
add tests for Value Viewer
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<value-viewer
|
||||
:empty="!selectedItem"
|
||||
empty-message="No node or edge selected to view"
|
||||
:cellValue="JSON.stringify(selectedItem)"
|
||||
:value="JSON.stringify(selectedItem)"
|
||||
default-format="json"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<value-viewer
|
||||
:empty="!selectedCell"
|
||||
empty-message="No cell selected to view"
|
||||
:cellValue="
|
||||
:value="
|
||||
selectedCell
|
||||
? result.values[result.columns[selectedCell.dataset.col]][
|
||||
selectedCell.dataset.row
|
||||
|
||||
@@ -73,7 +73,7 @@ export default {
|
||||
Logs
|
||||
},
|
||||
props: {
|
||||
cellValue: [String, Number, Uint8Array],
|
||||
value: [String, Number, Uint8Array],
|
||||
empty: Boolean,
|
||||
emptyMessage: String,
|
||||
defaultFormat: {
|
||||
@@ -108,13 +108,13 @@ export default {
|
||||
}
|
||||
},
|
||||
isBlob() {
|
||||
return this.cellValue && ArrayBuffer.isView(this.cellValue)
|
||||
return this.value && ArrayBuffer.isView(this.value)
|
||||
},
|
||||
isNull() {
|
||||
return this.cellValue === null
|
||||
return this.value === null
|
||||
},
|
||||
cellText() {
|
||||
const value = this.cellValue
|
||||
const value = this.value
|
||||
if (this.isNull) {
|
||||
return 'NULL'
|
||||
}
|
||||
@@ -131,16 +131,16 @@ export default {
|
||||
this.messages = []
|
||||
this.formattedJson = ''
|
||||
if (this.currentFormat === 'json') {
|
||||
this.formatJson(this.cellValue)
|
||||
this.formatJson(this.value)
|
||||
}
|
||||
}
|
||||
},
|
||||
cellValue: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.messages = []
|
||||
if (this.currentFormat === 'json') {
|
||||
this.formatJson(this.cellValue)
|
||||
this.formatJson(this.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export default {
|
||||
},
|
||||
copyToClipboard() {
|
||||
cIo.copyText(
|
||||
this.currentFormat === 'json' ? this.formattedJson : this.cellValue,
|
||||
this.currentFormat === 'json' ? this.formattedJson : this.value,
|
||||
'The value is copied to clipboard.'
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user