Explorar el Código

fix(tree): nodeContext visible bug

vian hace 5 años
padre
commit
9866f213e9
Se han modificado 4 ficheros con 4 adiciones y 4 borrados
  1. 1 1
      tree/package-lock.json
  2. 1 1
      tree/package.json
  3. 1 1
      tree/src/nodeCtx.ts
  4. 1 1
      tree/tests/nodeCtx.ts

+ 1 - 1
tree/package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/tree",
-  "version": "1.0.1",
+  "version": "1.0.3",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 1 - 1
tree/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@sc/tree",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "a template for npm package coding",
   "main": "./dist/index.cjs.js",
   "module": "./dist/index.esm.js",

+ 1 - 1
tree/src/nodeCtx.ts

@@ -47,7 +47,7 @@ export class NodeContext {
   visible(): boolean {
     let parent = this.parent();
     while (parent) {
-      if (parent.getCtx().expanded) {
+      if (!parent.getCtx().expanded) {
         return false;
       }
       parent = parent.getCtx().parent();

+ 1 - 1
tree/tests/nodeCtx.ts

@@ -51,7 +51,7 @@ describe('NodeCtx', () => {
         expect(visibleA).to.equal(false);
         node.getCtx().expanded = false;
         const visibleB = testNode.getCtx().visible();
-        expect(visibleB).to.equal(true);
+        expect(visibleB).to.equal(false);
       }
     }
   });