mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-12-15 18:07:15 +00:00
UI json edit test (#5705)
* add new codemirror helpers * adding json helpers to the secret pages * mark the edit button / link as the edit element instead of the json toggle * add acceptance tests for JSON editing
This commit is contained in:
34
ui/tests/pages/helpers/codemirror.js
Normal file
34
ui/tests/pages/helpers/codemirror.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import getCodeMirrorInstance from 'vault/tests/helpers/codemirror';
|
||||
// Like fillable, but for the CodeMirror editor
|
||||
//
|
||||
// Usage: fillIn: codeFillable('[data-test-editor]')
|
||||
// Page.fillIn(code);
|
||||
export function codeFillable(selector) {
|
||||
return {
|
||||
isDescriptor: true,
|
||||
|
||||
get() {
|
||||
return function(context, code) {
|
||||
const cm = getCodeMirrorInstance(context, selector);
|
||||
cm.setValue(code);
|
||||
return this;
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Like text, but for the CodeMirror editor
|
||||
//
|
||||
// Usage: content: code('[data-test-editor]')
|
||||
// Page.code(); // some = [ 'string', 'of', 'code' ]
|
||||
export function code(selector) {
|
||||
return {
|
||||
isDescriptor: true,
|
||||
get() {
|
||||
return function(context) {
|
||||
const cm = getCodeMirrorInstance(context, selector);
|
||||
return cm.getValue();
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user