tpmkms_4wp 9.1.1-beta.13 → 9.1.1-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/menus.js +39 -2
- package/common/tester.js +24 -2
- package/package.json +2 -2
package/common/menus.js
CHANGED
@@ -5,7 +5,7 @@ const helpers = require('./helpers/menus')
|
|
5
5
|
const tests = require('./menus.test.json')
|
6
6
|
const instance = require('./menus.instance.json')
|
7
7
|
|
8
|
-
class
|
8
|
+
class MenusAPI {
|
9
9
|
initialize({ objects, config }) {
|
10
10
|
this._config = config
|
11
11
|
this._objects = objects
|
@@ -160,6 +160,36 @@ const template = {
|
|
160
160
|
],
|
161
161
|
}
|
162
162
|
|
163
|
+
class UIAPI {
|
164
|
+
constructor(menusAPI) {
|
165
|
+
this.menusAPI = menusAPI
|
166
|
+
}
|
167
|
+
|
168
|
+
initialize() {
|
169
|
+
}
|
170
|
+
|
171
|
+
move(direction, steps = 1, units = undefined) {
|
172
|
+
this.menusAPI.move(direction, steps, units)
|
173
|
+
}
|
174
|
+
|
175
|
+
select(item) {
|
176
|
+
this.menusAPI.select(item)
|
177
|
+
}
|
178
|
+
|
179
|
+
unselect(item) {
|
180
|
+
this.menusAPI.unselect(item)
|
181
|
+
}
|
182
|
+
|
183
|
+
cancel(direction) {
|
184
|
+
this.menusAPI.cancel(direction)
|
185
|
+
}
|
186
|
+
|
187
|
+
stop(action) {
|
188
|
+
this.menusAPI.stop(action)
|
189
|
+
}
|
190
|
+
|
191
|
+
}
|
192
|
+
|
163
193
|
/*
|
164
194
|
show the file menu
|
165
195
|
pick the file open item
|
@@ -181,7 +211,14 @@ const fixtures = async ({api, fragment, s, config, objects, kms, isModule}) => {
|
|
181
211
|
knowledgeModule({
|
182
212
|
config,
|
183
213
|
includes: [ui],
|
184
|
-
api: () => new API(),
|
214
|
+
// api: () => new API(),
|
215
|
+
api: () => {
|
216
|
+
const menusAPI = new MenusAPI()
|
217
|
+
return {
|
218
|
+
'menus': menusAPI,
|
219
|
+
'ui': new UIAPI(menusAPI)
|
220
|
+
}
|
221
|
+
},
|
185
222
|
apiKMs: ['menus', 'ui'],
|
186
223
|
initializer: ({apis}) => {
|
187
224
|
apis('sdefaults').addAssociation('menus')
|
package/common/tester.js
CHANGED
@@ -3,13 +3,20 @@ const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const tester_tests = require('./tester.test.json')
|
4
4
|
const ArgumentParser = require('argparse').ArgumentParser
|
5
5
|
|
6
|
+
const testModuleNameFn = () => {
|
7
|
+
const parser = new ArgumentParser({ description: 'Get test module name' })
|
8
|
+
parser.add_argument('-tmn', '--testModuleName', { help: 'List of module to run the tests from' })
|
9
|
+
const [args, unknown] = parser.parse_known_args()
|
10
|
+
return args.testModuleName
|
11
|
+
}
|
12
|
+
const testModuleName = testModuleNameFn()
|
13
|
+
|
6
14
|
const parser = new ArgumentParser({
|
7
15
|
description: 'Test modules together'
|
8
16
|
})
|
9
17
|
|
10
18
|
parser.add_argument('-m', '--modules', { help: 'List of modules to load' })
|
11
19
|
const [args, unknown] = parser.parse_known_args()
|
12
|
-
|
13
20
|
process.argv = [process.argv[0], process.argv[1], ...unknown]
|
14
21
|
|
15
22
|
const createConfig = async () => {
|
@@ -29,12 +36,26 @@ const createConfig = async () => {
|
|
29
36
|
global.theprogrammablemind = {
|
30
37
|
loadForTesting: {}
|
31
38
|
}
|
39
|
+
|
32
40
|
const includes = args.modules.split(',').map((module) => {
|
33
41
|
global.theprogrammablemind.loadForTesting[module] = true
|
34
42
|
const km = require(`./${module}`)
|
35
43
|
return km
|
36
44
|
})
|
37
45
|
|
46
|
+
const fixtures = async (args) => {
|
47
|
+
const { config, kms, apis } = args;
|
48
|
+
if (kms[testModuleName].testConfig?.fixtures) {
|
49
|
+
const fixtures = kms.menus.testConfig?.fixtures
|
50
|
+
kms.menus.testConfig.fixtures = null
|
51
|
+
const testModuleApi = apis(testModuleName)
|
52
|
+
const objects = testModuleApi._objects
|
53
|
+
args.objects = objects
|
54
|
+
await fixtures({ ...args, objects, api: testModuleApi })
|
55
|
+
kms.menus.testConfig.fixtures = fixtures
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
38
59
|
knowledgeModule({
|
39
60
|
config: { name: 'tester' },
|
40
61
|
includes,
|
@@ -43,6 +64,7 @@ knowledgeModule({
|
|
43
64
|
description: 'Testing modules loaded together',
|
44
65
|
test: {
|
45
66
|
name: './tester.test.json',
|
46
|
-
contents: tester_tests
|
67
|
+
contents: tester_tests,
|
68
|
+
fixtures,
|
47
69
|
},
|
48
70
|
})
|
package/package.json
CHANGED
@@ -325,8 +325,8 @@
|
|
325
325
|
"scriptjs": "^2.5.9",
|
326
326
|
"table": "^6.7.1",
|
327
327
|
"uuid": "^9.0.0",
|
328
|
-
"theprogrammablemind_4wp": "9.1.1-beta.
|
328
|
+
"theprogrammablemind_4wp": "9.1.1-beta.14"
|
329
329
|
},
|
330
|
-
"version": "9.1.1-beta.
|
330
|
+
"version": "9.1.1-beta.14",
|
331
331
|
"license": "UNLICENSED"
|
332
332
|
}
|