Skip to content

Commit

Permalink
Merge branch 'master' into standalone-button
Browse files Browse the repository at this point in the history
  • Loading branch information
alexciesielski committed May 30, 2024
2 parents 8ac2e76 + d4daba0 commit 27ce5e5
Show file tree
Hide file tree
Showing 40 changed files with 3,589 additions and 2,064 deletions.
5,170 changes: 3,293 additions & 1,877 deletions package-lock.json

Large diffs are not rendered by default.

49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@
"url": "https://github.com/primefaces/primeng.git"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.3.6",
"@angular-eslint/eslint-plugin": "17.4.0",
"@angular-eslint/eslint-plugin-template": "17.4.0",
"@angular-eslint/schematics": "17.4.0",
"@angular-eslint/template-parser": "17.4.0",
"@angular/animations": "^17.3.7",
"@angular/cdk": "^17.3.7",
"@angular/cli": "^17.3.6",
"@angular/common": "^17.3.7",
"@angular/compiler": "^17.3.7",
"@angular/compiler-cli": "^17.3.7",
"@angular/core": "^17.3.7",
"@angular/forms": "^17.3.7",
"@angular/platform-browser": "^17.3.7",
"@angular/platform-browser-dynamic": "^17.3.7",
"@angular/platform-server": "^17.3.7",
"@angular/router": "^17.3.7",
"@angular-devkit/build-angular": "^18.0.2",
"@angular-eslint/eslint-plugin": "18.0.0",
"@angular-eslint/eslint-plugin-template": "18.0.0",
"@angular-eslint/schematics": "18.0.0",
"@angular-eslint/template-parser": "18.0.0",
"@angular/animations": "^18.0.1",
"@angular/cdk": "^18.0.1",
"@angular/cli": "^18.0.2",
"@angular/common": "^18.0.1",
"@angular/compiler": "^18.0.1",
"@angular/compiler-cli": "^18.0.1",
"@angular/core": "^18.0.1",
"@angular/forms": "^18.0.1",
"@angular/platform-browser": "^18.0.1",
"@angular/platform-browser-dynamic": "^18.0.1",
"@angular/platform-server": "^18.0.1",
"@angular/router": "^18.0.1",
"@stackblitz/sdk": "1.9.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~4.3.1",
"@types/jest": "^29.5.1",
"@types/node": "^16.18.67",
"@types/react": "^18.2.41",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"chart.js": "4.4.2",
"codelyzer": "^0.0.28",
"del": "^7.1.0",
"domino": "^2.1.6",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-prefer-arrow": "latest",
Expand All @@ -73,19 +73,20 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"ng-packagr": "^17.3.0",
"prettier": "2.8.8",
"prettier": "^3.0.0",
"ng-packagr": "^18.0.0",
"primeflex": "^3.3.1",
"primeicons": "^7.0.0",
"prismjs": "^1.29.0",
"quill": "2.0.2",
"rxjs": "~7.8.1",
"ts-node": "~10.9.1",
"tslib": "^2.5.0",
"typedoc": "0.25.4",
"typescript": "5.2.2",
"typedoc": "0.25.13",
"typescript": "5.4.5",
"xlsx": "^0.18.5",
"zone.js": "~0.14.0",
"@angular/ssr": "^17.3.6",
"@angular/ssr": "^18.0.1",
"@docsearch/js": "^3.3.4",
"esbuild": "^0.19.8"
}
Expand Down
1 change: 1 addition & 0 deletions src/app/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ export class Accordion implements BlockableUI, AfterContentInit, OnDestroy {
}
});
this.preventActiveIndexPropagation = true;
this._activeIndex = index;
this.activeIndexChange.emit(index as number[] | number);
}

Expand Down
6 changes: 4 additions & 2 deletions src/app/components/api/filterservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,11 @@ export class FilterService {
if (value === undefined || value === null) {
return false;
}
value.setHours(0, 0, 0, 0);

return value.getTime() > filter.getTime();
const valueCopy = new Date(value);
valueCopy.setHours(0, 0, 0, 0);

return valueCopy.getTime() > filter.getTime();
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/api/treenode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export interface TreeNode<T = any> {
*/
key?: string;
/**
* Mandatory unique key of the node.
* Defines if the node is loading.
*/
loading?: boolean;
}
2 changes: 1 addition & 1 deletion src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr

handleSuggestionsChange() {
if (this.loading) {
this._suggestions() ? this.show() : !!this.emptyTemplate ? this.show() : this.hide();
this._suggestions().length > 0 || this.showEmptyMessage ? this.show() : !!this.emptyTemplate ? this.show() : this.hide();
const focusedOptionIndex = this.overlayVisible && this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
this.focusedOptionIndex.set(focusedOptionIndex);
this.suggestionsUpdated = true;
Expand Down
52 changes: 52 additions & 0 deletions src/app/components/calendar/calendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,58 @@ describe('Calendar', () => {
flush();
}));

it('should hide overlay on range calendar when hideOnDateTimeSelect is true', fakeAsync(() => {
calendar.hideOnDateTimeSelect = true;
calendar.selectionMode = 'range';
fixture.detectChanges();

const inputEl = fixture.debugElement.query(By.css('.p-inputtext'));
const focusEvent = new Event('focus');
inputEl.nativeElement.click();
inputEl.nativeElement.dispatchEvent(focusEvent);
fixture.detectChanges();

const datesContainer = fixture.debugElement.query(By.css('.p-datepicker-calendar-container'));
const dates = datesContainer.query(By.css('tbody')).queryAll(By.css('span:not(.p-datepicker-weeknumber):not(.p-disabled)'));
dates[0].nativeElement.click();
tick(150);
fixture.detectChanges();


dates[1].nativeElement.click();
tick(150);
fixture.detectChanges();

expect(calendar.overlayVisible).toEqual(false);
flush();
}));

it('should keep overlay visible on range calendar when hideOnDateTimeSelect is false', fakeAsync(() => {
calendar.hideOnDateTimeSelect = false;
calendar.selectionMode = 'range';
fixture.detectChanges();

const inputEl = fixture.debugElement.query(By.css('.p-inputtext'));
const focusEvent = new Event('focus');
inputEl.nativeElement.click();
inputEl.nativeElement.dispatchEvent(focusEvent);
fixture.detectChanges();

const datesContainer = fixture.debugElement.query(By.css('.p-datepicker-calendar-container'));
const dates = datesContainer.query(By.css('tbody')).queryAll(By.css('span:not(.p-datepicker-weeknumber):not(.p-disabled)'));
dates[0].nativeElement.click();
tick(150);
fixture.detectChanges();


dates[1].nativeElement.click();
tick(150);
fixture.detectChanges();

expect(calendar.overlayVisible).toEqual(true);
flush();
}));

it('should be next year', () => {
const date = new Date(2017, 11, 23);
calendar.defaultDate = date;
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
}
}

if ((this.isSingleSelection() && this.hideOnDateTimeSelect) || (this.isRangeSelection() && this.value[1])) {
if (this.hideOnDateTimeSelect && (this.isSingleSelection() || (this.isRangeSelection() && this.value[1]))) {
setTimeout(() => {
event.preventDefault();
this.hideOverlay();
Expand Down Expand Up @@ -2474,6 +2474,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
} else {
this.initFocusableCell();
}
this.alignOverlay();
}

initFocusableCell() {
Expand Down
68 changes: 44 additions & 24 deletions src/app/components/contextmenu/contextmenu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ContextMenu, ContextMenuModule } from './contextmenu';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand Down Expand Up @@ -90,7 +90,7 @@ class TestContextMenuTest {
];
}

describe('ConextMenu', () => {
describe('ContextMenu', () => {
let contextmenu: ContextMenu;
let contextmenuP: ContextMenu;
let fixture: ComponentFixture<TestContextMenuTest>;
Expand All @@ -110,7 +110,7 @@ describe('ConextMenu', () => {
it('should create container by default', () => {
fixture.detectChanges();

const containerEls = fixture.debugElement.queryAll(By.css('.p-contextmenu'));
const containerEls = fixture.debugElement.queryAll(By.css('p-contextmenu'));
expect(containerEls.length).toEqual(2);
});

Expand All @@ -128,7 +128,7 @@ describe('ConextMenu', () => {
expect(showSpy).toHaveBeenCalled();
});

it('should close contextmenu when outside click (global)', () => {
it('should close contextmenu when outside click (global)', fakeAsync(() => {
fixture.detectChanges();

const contextmenuEvent: any = document.createEvent('CustomEvent');
Expand All @@ -139,46 +139,58 @@ describe('ConextMenu', () => {
fixture.detectChanges();

const closeSpy = spyOn(contextmenu, 'hide').and.callThrough();
document.dispatchEvent(new Event('click'));
fixture.detectChanges();
fixture.whenStable().then(() => {
document.dispatchEvent(new Event('click'));
});
tick();

expect(closeSpy).toHaveBeenCalled();
});
}));

it('should close contextmenu when outside window resize (global)', () => {
it('should close contextmenu when outside window resize (global)', fakeAsync(() => {
contextmenu.appendTo = 'body';
fixture.detectChanges();

const showSpy = spyOn(contextmenu, 'show').and.callThrough();
const contextmenuEvent: any = document.createEvent('CustomEvent');
contextmenuEvent.pageX = 20;
contextmenuEvent.pageY = 20;
contextmenuEvent.initEvent('contextmenu', true, true);
document.dispatchEvent(contextmenuEvent);
fixture.detectChanges();

expect(showSpy).toHaveBeenCalled();

const hideSpy = spyOn(contextmenu, 'hide').and.callThrough();
window.dispatchEvent(new Event('resize'));
fixture.detectChanges();
fixture.whenStable().then(() => {
window.dispatchEvent(new Event('resize'));
});
tick();

expect(hideSpy).toHaveBeenCalled();
});
}));

it('should open and close programmaticlaly', () => {
it('should open and close programmatically', fakeAsync(() => {
fixture.detectChanges();

const showSpy = spyOn(contextmenu, 'show').and.callThrough();
contextmenu.toggle();

const contextmenuEvent: any = document.createEvent('CustomEvent');
contextmenuEvent.pageX = 20;
contextmenuEvent.pageY = 20;
contextmenu.toggle(contextmenuEvent);
fixture.detectChanges();

expect(showSpy).toHaveBeenCalled();
const hideSpy = spyOn(contextmenu, 'hide').and.callThrough();
contextmenu.toggle();
tick();
fixture.detectChanges();

expect(hideSpy).toHaveBeenCalled();
});
}));

it('should open contextmenu (target)', () => {
it('should open contextmenu (target)', fakeAsync(() => {
fixture.detectChanges();

const showSpy = spyOn(contextmenuP, 'show').and.callThrough();
Expand All @@ -188,12 +200,13 @@ describe('ConextMenu', () => {
contextmenuEvent.pageY = 20;
contextmenuEvent.initEvent('contextmenu', true, true);
target.nativeElement.dispatchEvent(contextmenuEvent);
tick();
fixture.detectChanges();

expect(showSpy).toHaveBeenCalled();
});
}));

it('should close contextmenu when outside click (target)', () => {
it('should close contextmenu when outside click (target)', fakeAsync(() => {
fixture.detectChanges();

const target = fixture.debugElement.query(By.css('p'));
Expand All @@ -202,31 +215,38 @@ describe('ConextMenu', () => {
contextmenuEvent.pageY = 20;
contextmenuEvent.initEvent('contextmenu', true, true);
target.nativeElement.dispatchEvent(contextmenuEvent);
tick();
fixture.detectChanges();

const closeSpy = spyOn(contextmenuP, 'hide').and.callThrough();
document.dispatchEvent(new Event('click'));
fixture.detectChanges();
fixture.whenStable().then(() => {
document.dispatchEvent(new Event('click'));
});
tick();

expect(closeSpy).toHaveBeenCalled();
});
}));

it('should close contextmenu when outside window resize (target)', () => {
it('should close contextmenu when outside window resize (target)', fakeAsync(() => {
contextmenu.appendTo = 'body';
fixture.detectChanges();

const showSpy = spyOn(contextmenuP, 'show').and.callThrough();
const target = fixture.debugElement.query(By.css('p'));
const contextmenuEvent: any = document.createEvent('CustomEvent');
contextmenuEvent.pageX = 20;
contextmenuEvent.pageY = 20;
contextmenuEvent.initEvent('contextmenu', true, true);
target.nativeElement.dispatchEvent(contextmenuEvent);
fixture.detectChanges();
expect(showSpy).toHaveBeenCalled();

const hideSpy = spyOn(contextmenuP, 'hide').and.callThrough();
window.dispatchEvent(new Event('resize'));
fixture.detectChanges();
fixture.whenStable().then(() => {
window.dispatchEvent(new Event('resize'));
});
tick();

expect(hideSpy).toHaveBeenCalled();
});
}));
});
10 changes: 4 additions & 6 deletions src/app/components/editor/editor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { Editor } from './editor';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand All @@ -7,15 +7,15 @@ describe('Editor', () => {
let editor: Editor;
let fixture: ComponentFixture<Editor>;

beforeEach(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule],
declarations: [Editor]
});

fixture = TestBed.createComponent(Editor);
editor = fixture.componentInstance;
});
}));

it('should display by default', () => {
fixture.detectChanges();
Expand All @@ -25,9 +25,7 @@ describe('Editor', () => {
});

it('should show value', () => {
editor.value = 'V';
fixture.detectChanges();

editor.writeValue('V');
fixture.detectChanges();

const paragraphEl = fixture.debugElement.query(By.css('.p-editor-content')).nativeElement.children[0].children[0];
Expand Down
Loading

0 comments on commit 27ce5e5

Please sign in to comment.