New PageObject helper for getting and setting CodeMirror values
This commit is contained in:
parent
9fb8964c00
commit
e634a98102
|
@ -0,0 +1,32 @@
|
|||
// 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(code) {
|
||||
const cm = getCodeMirrorInstance(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() {
|
||||
const cm = getCodeMirrorInstance(selector);
|
||||
return cm.getValue();
|
||||
},
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue