Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@
height: 34px;
padding: 4px 16px;
cursor: pointer;
font-size: 14px;
font-size: 15px;
align-items: center;

.checkbox {
margin: 0px;
color: $gray-3;

::ng-deep .mat-ripple {
display: none;
}
}

.icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { createHostFactory, mockProvider, SpectatorHost } from '@ngneat/spectato
import { MockComponent } from 'ng-mocks';
import { NEVER } from 'rxjs';
import { ButtonComponent } from '../button/button.component';
import { CheckboxComponent } from '../checkbox/checkbox.component';
import { DividerComponent } from '../divider/divider.component';
import { LabelComponent } from '../label/label.component';
import { LoadAsyncModule } from '../load-async/load-async.module';
Expand All @@ -30,7 +31,8 @@ describe('Multi Select Component', () => {
MockComponent(LabelComponent),
MockComponent(DividerComponent),
MockComponent(SearchBoxComponent),
MockComponent(ButtonComponent)
MockComponent(ButtonComponent),
MockComponent(CheckboxComponent)
],
shallow: true
});
Expand Down Expand Up @@ -91,7 +93,7 @@ describe('Multi Select Component', () => {
});

spectator.tick();
const selectedElements = spectator.queryAll('input:checked', { root: true });
const selectedElements = spectator.queryAll(CheckboxComponent);
expect(selectedElements.length).toBe(2);
}));

Expand Down Expand Up @@ -121,7 +123,7 @@ describe('Multi Select Component', () => {
expect(spectator.query('.multi-select-content', { root: true })).toExist();
expect(optionElements.length).toBe(6);

const selectedElements = spectator.queryAll('input:checked', { root: true });
const selectedElements = spectator.queryAll(CheckboxComponent);
expect(selectedElements.length).toBe(2);

optionElements.forEach((element, index) => {
Expand Down Expand Up @@ -216,7 +218,7 @@ describe('Multi Select Component', () => {
spectator.click(clearSelectedButton!);

spectator.tick();
expect(spectator.queryAll('input:checked', { root: true }).length).toBe(0);
expect(spectator.queryAll(CheckboxComponent).length).toBe(0);
expect(onChange).toHaveBeenCalledTimes(1);
expect(onChange).toHaveBeenLastCalledWith([]);
expect(spectator.query(LabelComponent)?.label).toEqual('Select options');
Expand All @@ -226,7 +228,7 @@ describe('Multi Select Component', () => {
spectator.click(allOptionElement!);

spectator.tick();
const selectedElements = spectator.queryAll('input:checked', { root: true });
const selectedElements = spectator.queryAll(CheckboxComponent);
expect(selectedElements.length).toBe(6);

expect(onChange).toHaveBeenCalledWith(selectionOptions.map(option => option.value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import { MultiSelectJustify } from './multi-select-justify';
(click)="this.onSelectionChange(item)"
class="multi-select-option"
>
<input class="checkbox" type="checkbox" [checked]="this.isSelectedItem(item)" />
<ht-checkbox class="checkbox" [checked]="this.isSelectedItem(item)"></ht-checkbox>
<ht-icon
class="icon"
*ngIf="item.icon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ButtonModule } from '../button/button.module';
import { TraceCheckboxModule } from '../checkbox/checkbox.module';
import { DividerModule } from '../divider/divider.module';
import { IconModule } from '../icon/icon.module';
import { LabelModule } from '../label/label.module';
Expand All @@ -18,7 +19,8 @@ import { MultiSelectComponent } from './multi-select.component';
DividerModule,
TraceSearchBoxModule,
ButtonModule,
LoadAsyncModule
LoadAsyncModule,
TraceCheckboxModule
],
declarations: [MultiSelectComponent],
exports: [MultiSelectComponent]
Expand Down