Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit bde549f

Browse files
committed
fix style for test builder code block
1 parent eac3189 commit bde549f

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

golem/gui/static/css/test_case.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ body.modal-open {
209209
border-radius: 3px;
210210
}
211211

212+
.code-block .CodeMirror-scroll {
213+
min-height: 50px
214+
}
215+
212216
.CodeMirror-lines {
213217
padding: 6px 0; /* Vertical padding around content */
214218
}

golem/gui/static/js/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ var Test = new function(){
123123
indentWithTabs: false,
124124
extraKeys: {
125125
Tab: TestCommon.Utils.convertTabToSpaces
126-
}
126+
},
127+
viewportMargin: Infinity
127128
});
128129
setTimeout(() => editor.refresh(), 250);
129130
editor.on('change', editor => Test.unsavedChanges = true);

golem/gui/static/js/test_code.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,61 @@ const TestCode = new function() {
2727
styleActiveLine: true,
2828
matchBrackets: true,
2929
indentUnit: 4,
30+
indentWithTabs: false,
31+
extraKeys: {
32+
Tab: TestCommon.Utils.convertTabToSpaces
33+
},
3034
});
3135
codeEditor = this.codeEditor;
3236
CodeMirror.commands.autocomplete = function(cm) {
33-
34-
CodeMirror.simpleHint(cm, CodeMirror.pythonHint);
35-
}
36-
codeEditor.on("keyup", function (cm, event) {
37-
if (!cm.state.completionActive && /*Enables keyboard navigation in autocomplete list*/
38-
(event.keyCode > 64 && event.keyCode < 220) || (event.keyCode==190)){// only when a letter key is pressed
39-
codeEditor.execCommand("autocomplete")
40-
}
41-
});
37+
CodeMirror.simpleHint(cm, CodeMirror.pythonHint);
38+
}
39+
codeEditor.on("keyup", function (cm, event) {
40+
if (!cm.state.completionActive && /*Enables keyboard navigation in autocomplete list*/
41+
(event.keyCode > 64 && event.keyCode < 220) || (event.keyCode==190)) {// only when a letter key is pressed
42+
codeEditor.execCommand("autocomplete")
43+
}
44+
});
4245

43-
if(Global.user.projectWeight < Main.PermissionWeightsEnum.standard){
46+
if(Global.user.projectWeight < Main.PermissionWeightsEnum.standard) {
4447
this.codeEditor.setOption('readOnly', 'nocursor')
4548
}
4649
// set unsaved changes watcher
4750
this.watchForUnsavedChanges();
4851
}
52+
4953
this.getGolemActions = function(){
5054
xhr.get('/api/golem/actions', {
5155
project: this.file.project
5256
}, golemAction => {
5357
golemAction.forEach(function(action) {
54-
TestCode.golemActions.push(action.name)
55-
})
58+
TestCode.golemActions.push(action.name)
59+
})
5660
})
5761

5862
}
5963
this.getAllProjectPages = function(){
6064
xhr.get('/api/project/pages', {
6165
project: this.file.project
6266
}, pages => {
63-
pages.forEach(function(page){
64-
TestCode.getPageContents(page)
65-
});
67+
pages.forEach(function(page) {
68+
TestCode.getPageContents(page)
69+
});
6670
})
6771
}
6872
this.getPageContents = function(pageName){
6973
xhr.get('/api/page/components', {
7074
project: this.file.project,
7175
page: pageName
7276
}, result => {
73-
if(result.error == 'page does not exist'){
77+
if(result.error == 'page does not exist') {
7478
// mark page as not existent
7579
$(`input[value='${pageName}']`).addClass('not-exist');
76-
}
77-
else{
80+
} else {
7881
let elemets = result.components.elements
7982
elemets.forEach(function(pagefull){
8083
TestCode.importedPages.push(pagefull.full_name)
81-
})
84+
})
8285
}
8386
})
8487
}

0 commit comments

Comments
 (0)