Skip to content

Commit

Permalink
fix(tree): fix loading style
Browse files Browse the repository at this point in the history
fix(tree): fix style
  • Loading branch information
simplejason committed Aug 8, 2018
1 parent 30498c8 commit b3faefb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 6 additions & 6 deletions components/tree/nz-tree-node.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<li #dragElement
[class.ant-tree-treenode-loading]="nzTreeNode.isLoading && !nzTreeNode.isLeaf"
[class.ant-tree-treenode-disabled]="nzTreeNode.isDisabled"
(dblclick)="_dblClickNode($event,nzTreeNode)"
(click)="_clickNode($event,nzTreeNode)"
Expand All @@ -7,12 +8,11 @@
<span
class="ant-tree-switcher"
[ngStyle]="loadingStyle"
[class.ant-tree-switcher_open]="nzTreeNode.isExpanded && !nzTreeNode.isLeaf && !nzTreeNode.isLoading"
[class.ant-tree-switcher_close]="!nzTreeNode.isExpanded && !nzTreeNode.isLeaf && !nzTreeNode.isLoading"
[class.ant-tree-switcher-noop]="nzTreeNode.isLeaf && !nzTreeNode.isLoading"
[class.ant-tree-switcher-disabled]="nzTreeNode.isDisabled && !nzTreeNode.isLoading"
[class.ant-tree-switcher_open]="nzTreeNode.isExpanded && !nzTreeNode.isLeaf"
[class.ant-tree-switcher_close]="!nzTreeNode.isExpanded && !nzTreeNode.isLeaf"
[class.ant-tree-switcher-noop]="nzTreeNode.isLeaf"
[class.ant-tree-switcher-disabled]="nzTreeNode.isDisabled"
[class.ant-tree-iconEle]="nzTreeNode.isLoading && !nzTreeNode.isLeaf"
[class.ant-tree-icon_loading]="nzTreeNode.isLoading && !nzTreeNode.isLeaf"
[class.ant-tree-icon__open]="nzTreeNode.isLoading && nzTreeNode.isExpanded && !nzTreeNode.isLeaf"
[class.ant-tree-icon__close]="nzTreeNode.isLoading && !nzTreeNode.isExpanded && !nzTreeNode.isLeaf"
(click)="_clickExpand($event, nzTreeNode)">
Expand Down Expand Up @@ -86,4 +86,4 @@
(nzDragEnd)="nzDragEnd.emit($event)">
</nz-tree-node>
</ul>
</li>
</li>
5 changes: 1 addition & 4 deletions components/tree/nz-tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,9 @@ describe('tree component test', () => {
// init
expect(treeElement.querySelectorAll('.ant-tree-switcher').length).toEqual(3);
// click expand, test can not excute add children
let targetNode = treeElement.querySelectorAll('.ant-tree-switcher')[ 0 ];
const targetNode = treeElement.querySelectorAll('.ant-tree-switcher')[ 0 ];
dispatchMouseEvent(targetNode, 'click');
fixture.detectChanges();
targetNode = treeElement.querySelectorAll('.ant-tree-switcher')[ 0 ];
expect(targetNode.classList).toContain('ant-tree-icon_loading');
fixture.detectChanges();
expect(expandSpy).toHaveBeenCalled();
expect(expandSpy).toHaveBeenCalledTimes(1);
});
Expand Down

0 comments on commit b3faefb

Please sign in to comment.