Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
dotCMS/core#19585 UI bug in the login as selector
Browse files Browse the repository at this point in the history
* Fixes the UI bug in Login As and changed how the dot-searchable-dropdown overlay width was being set

* Fix tests

* Removed fit from tests

* Added test for overlayWidth

* Removed fit
  • Loading branch information
ivorpad authored and fmontes committed Nov 18, 2020
1 parent 56b9b8d commit 441696a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
icon="pi pi-chevron-down"
iconPos="right"
type="button"
[ngStyle]="{ width: width + 'px' }"
[ngStyle]="{ width: width }"
[disabled]="disabled"
></button>
</ng-template>
Expand All @@ -28,7 +28,7 @@
(onShow)="showOverlayHandler()"
[dismissable]="true"
[styleClass]="cssClass"
[style]="{ 'min-height': overlayPanelMinHeight + 'px', width: (overlayWidth || width) + 'px' }"
[style]="{ 'min-height': overlayPanelMinHeight + 'px', width: overlayWidth }"
appendTo="body"
>
<header class="searchable-dropdown__search">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('SearchableDropdownComponent', () => {
it('should set CSS class, width', fakeAsync(() => {
hostFixture.componentInstance.data = data;
hostFixture.componentInstance.cssClass = 'testClass';
hostFixture.componentInstance.overlayWidth = '650';
hostFixture.componentInstance.overlayWidth = '650px';
hostFixture.detectChanges();
tick();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default {
],
placeholder: 'Select something',
labelPropertyName: 'label',
width: '300'
width: '300px'
}
} as Meta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,23 @@ export class SearchableDropdownComponent
@Input()
persistentPlaceholder: boolean;

/**
* Sets the width of the searchable-dropdown button
*
* The CSS unit is **required**.
* @memberof SearchableDropdownComponent
*/
@Input()
width = '300';
width = '300px';

/**
* Sets the width of the searchable-dropdown overlay
*
* The CSS unit is **required**.
* @memberof SearchableDropdownComponent
*/
@Input()
overlayWidth;
overlayWidth = '300px';

@Input()
multiple: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[labelPropertyName]="['name', 'parentPermissionable.hostname']"
placeholder="{{ 'editpage.container.add.label' | dm }}"
persistentPlaceholder="true"
width="160"
overlayWidth="300"
width="172px"
overlayWidth="300px"
class="d-secondary"
[multiple]="multiple"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[(ngModel)]="value"
[action]="addAction"
[data]="personas"
[width]="448"
width="448px"
[rows]="paginationPerPage"
[totalRecords]="paginationService.totalRecords"
labelPropertyName="name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ describe('DotPersonaSelectorComponent', () => {

it('should set dot-searchable-dropdown with right attributes', () => {
expect(dropdown.componentInstance.labelPropertyName).toBe('name');
expect(dropdown.componentInstance.width).toBe(448);
expect(dropdown.componentInstance.width).toBe('448px');
expect(dropdown.componentInstance.overlayWidth).toBe('300px');
expect(dropdown.componentInstance.rows).toBe(10);
expect(dropdown.componentInstance.totalRecords).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
id="login-as-form"
#formEl="ngForm"
novalidate
class="p-fluid"
>
<div class="p-field">
<!--TODO: get rid of this let autoComplete when this is fixed: https://github.com/primefaces/primeng/issues/745-->
Expand All @@ -28,7 +29,7 @@
placeholder="{{ 'loginas.select.loginas.user' | dm }}"
formControlName="loginAsUser"
labelPropertyName="fullName"
width="100%"
overlayWidth="300px"
>
</dot-searchable-dropdown>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[archive]="false"
class="toolbar__site-selector"
cssClass="d-secondary"
width="200"
width="200px"
>
</dot-site-selector>
<span class="toolbar__sep"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/view/components/dot-toolbar/dot-toolbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('DotToolbarComponent', () => {
it(`should pass class and width`, () => {
const siteSelector: DebugElement = fixture.debugElement.query(By.css('dot-site-selector'));
expect(siteSelector.componentInstance.cssClass).toBe('d-secondary');
expect(siteSelector.componentInstance.width).toBe('200');
expect(siteSelector.componentInstance.width).toBe('200px');
});

it('should toggle menu and update icon on click', () => {
Expand Down

0 comments on commit 441696a

Please sign in to comment.