Skip to content

Commit b78179d

Browse files
Andrei CaleniucAndrei Caleniuc
authored andcommitted
fix: ui-tree-select styles
1 parent 0d76fca commit b78179d

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

projects/angular/components/ui-tree-select/src/ui-tree-item/ui-tree-item.component.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
import { range } from 'lodash-es';
2+
13
import {
2-
Component, NO_ERRORS_SCHEMA, ViewChild,
4+
Component,
5+
NO_ERRORS_SCHEMA,
6+
ViewChild,
37
} from '@angular/core';
48
import {
5-
ComponentFixture, TestBed,
9+
ComponentFixture,
10+
TestBed,
611
} from '@angular/core/testing';
712
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
813
import { UiTreeItemComponent } from '@uipath/angular/components/ui-tree-select';
9-
import { range } from 'lodash-es';
1014

1115
@Component({
1216
template: `<ui-tree-item
@@ -95,16 +99,16 @@ describe('UiTreeItemComponent', () => {
9599
expect(component.expanded).toHaveBeenCalled();
96100
});
97101

98-
it('should focus the inner mat-list-item component', () => {
99-
const matListItem = fixture.nativeElement.querySelector('.mat-list-item');
102+
it('should focus the inner list item component', () => {
103+
const matListItem = fixture.nativeElement.querySelector('.mat-mdc-list-item');
100104
expect(document.activeElement).not.toBe(matListItem);
101105
component.treeItemComponent?.focus();
102106
fixture.detectChanges();
103107
expect(document.activeElement).toBe(matListItem);
104108
});
105109

106110
it('should forward values for getBoundingClientRect', () => {
107-
const matListItem = fixture.nativeElement.querySelector('.mat-list-item');
111+
const matListItem = fixture.nativeElement.querySelector('.mat-mdc-list-item');
108112
expect(component.treeItemComponent?.getBoundingClientRect()).toEqual(matListItem.getBoundingClientRect());
109113
});
110114
});

projects/angular/components/ui-tree-select/src/ui-tree-item/ui-tree-item.component.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import { FocusableOption } from '@angular/cdk/a11y';
22
import { CommonModule } from '@angular/common';
33
import {
4-
Component,
5-
ChangeDetectionStrategy,
6-
Input,
7-
ViewEncapsulation,
8-
ElementRef,
9-
forwardRef,
10-
Inject,
11-
Output,
12-
EventEmitter,
4+
ChangeDetectionStrategy,
5+
Component,
6+
ElementRef,
7+
EventEmitter,
8+
forwardRef,
9+
Inject,
10+
Input,
11+
Output,
12+
ViewEncapsulation,
1313
} from '@angular/core';
1414
import { MatListModule } from '@angular/material/list';
15+
1516
import { IFlatNodeObject } from '../models/tree.models';
1617

18+
const LIST_ITEM_SELECTOR = '.mat-mdc-list-item';
19+
1720
@Component({
1821
standalone: true,
1922
imports: [
@@ -53,10 +56,10 @@ export class UiTreeItemComponent implements FocusableOption {
5356
}
5457

5558
focus() {
56-
this._el.nativeElement.querySelector('.mat-list-item').focus();
59+
this._el.nativeElement.querySelector(LIST_ITEM_SELECTOR).focus();
5760
}
5861

5962
getBoundingClientRect() {
60-
return this._el.nativeElement.querySelector('.mat-list-item').getBoundingClientRect();
63+
return this._el.nativeElement.querySelector(LIST_ITEM_SELECTOR).getBoundingClientRect();
6164
}
6265
}

projects/angular/components/ui-tree-select/src/ui-tree-select.component.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
.tree-item-container {
2-
display: flex;
3-
flex-direction: row;
4-
align-items: center;
52
height: 100%;
3+
4+
.mdc-list-item__primary-text {
5+
display: flex;
6+
flex-direction: row;
7+
align-items: center;
8+
}
69
}
710

811
@mixin perLevelPadding($level, $padding) {

0 commit comments

Comments
 (0)