Skip to content

Commit 36868ba

Browse files
committed
test(testmacro): update test for protected properties (calling setter in newInstance)
update test for protected properties to test the calling of publicAPI.set(initialValues) within the extend method
1 parent 8925478 commit 36868ba

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

Sources/Testing/testMacro.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const DEFAULT_VALUES = {
3535
myProp11: 11,
3636
_myProp12: [12],
3737
_myProp13: 13,
38+
myProp14: 14,
3839
};
3940

4041
// ----------------------------------------------------------------------------
@@ -72,7 +73,12 @@ function extend(publicAPI, model, initialValues = {}) {
7273
// Protected variables
7374
macro.setGet(publicAPI, model, ['_myProp11']);
7475
macro.setGetArray(publicAPI, model, ['_myProp12'], 1);
75-
macro.moveToProtected(publicAPI, model, ['myProp11', 'myProp12', 'myProp13']);
76+
macro.moveToProtected(publicAPI, model, [
77+
'myProp11',
78+
'myProp12',
79+
'myProp13',
80+
'myProp14',
81+
]);
7682

7783
// Object specific methods
7884
myClass(publicAPI, model);
@@ -337,12 +343,17 @@ test('Macro protected variables tests', (t) => {
337343
_myProp11: 111,
338344
_myProp12: [112],
339345
_myProp13: 113,
346+
_myProp14: 114,
340347
});
341-
t.deepEqual(overridenInstance2.get('_myProp11', '_myProp12', '_myProp13'), {
342-
_myProp11: DEFAULT_VALUES.myProp11, // TBD
343-
_myProp12: [112],
344-
_myProp13: 113,
345-
});
348+
t.deepEqual(
349+
overridenInstance2.get('_myProp11', '_myProp12', '_myProp13', '_myProp14'),
350+
{
351+
_myProp11: 111,
352+
_myProp12: [112],
353+
_myProp13: 113,
354+
_myProp14: 114,
355+
}
356+
);
346357
t.end();
347358
});
348359

Sources/macros.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ export function obj(publicAPI = {}, model = {}) {
317317
} else {
318318
// Set data on model directly
319319
if (['mtime'].indexOf(name) === -1 && !noWarning) {
320-
vtkWarningMacro(
321-
`Warning: Set value to model directly ${name}, ${map[name]}`
322-
);
320+
// vtkWarningMacro(
321+
// `Warning: Set value to model directly ${name}, ${map[name]}`;
322+
// );
323323
}
324324
ret = model[name] !== map[name] || ret;
325325
model[name] = map[name];

0 commit comments

Comments
 (0)