From 130ed03fed97ee4dbe6589597bb8fa9e5a629a93 Mon Sep 17 00:00:00 2001 From: adpare Date: Wed, 21 Feb 2024 16:01:39 -0500 Subject: [PATCH] merged file from develop --- nav-app/src/app/tabs/tabs.component.spec.ts | 99 +-------------------- 1 file changed, 1 insertion(+), 98 deletions(-) diff --git a/nav-app/src/app/tabs/tabs.component.spec.ts b/nav-app/src/app/tabs/tabs.component.spec.ts index 598aab8f9..53a64d71b 100755 --- a/nav-app/src/app/tabs/tabs.component.spec.ts +++ b/nav-app/src/app/tabs/tabs.component.spec.ts @@ -154,105 +154,8 @@ describe('TabsComponent', () => { expect(selectTabSpy).toHaveBeenCalledWith(existingTab); }); -<<<<<<< HEAD - it('should emit on theme change', () => { - spyOn(component.onUserThemeChange, 'emit'); - component.handleUserThemeChange('dark'); - expect(component.onUserThemeChange.emit).toHaveBeenCalled(); - }); - - it('should copy link', fakeAsync(() => { - let mockedDocElement = document.createElement('input'); - mockedDocElement.id = 'layerLink'; - mockedDocElement.value = 'test1'; - mockedDocElement.type = 'text'; - document.getElementById = jasmine.createSpy('layerLink').and.returnValue(mockedDocElement); - const logSpy = spyOn(console, 'debug'); - component.copyLayerLink(); - flush(); - expect(logSpy).toHaveBeenCalledWith('copied', mockedDocElement.value); - })); - - it('should open upload prompt', fakeAsync(() => { - let mockedDocElement = document.createElement('input'); - mockedDocElement.id = 'uploader'; - mockedDocElement.value = 'test1'; - mockedDocElement.type = 'text'; - document.getElementById = jasmine.createSpy('uploader').and.returnValue(mockedDocElement); - const logSpy = spyOn(mockedDocElement, 'click'); - component.openUploadPrompt(); - flush(); - expect(logSpy).toHaveBeenCalled(); - })); - - it('should test toggle in filter', () => { - let filter = new Filter(); - filter.platforms.options = ['Linux', 'macOS', 'Windows']; - filter.platforms.selection = ['Linux']; - expect(filter.inFilter('platforms', 'Linux')).toEqual(true); - filter.toggleInFilter('platforms', 'Linux'); - expect(filter.platforms.selection).toEqual([]); - filter.toggleInFilter('platforms', 'macOS'); - expect(filter.platforms.selection).toEqual(['macOS']); - filter.deserialize(JSON.stringify(MockLayers.layerFile1.filters.platforms)); - let consoleSpy = spyOn(console, 'error'); - filter.toggleInFilter('platforms', 'PRE'); - expect(consoleSpy).toHaveBeenCalledWith( - 'not a valid option to toggle', - 'PRE', - Object({ selection: ['macOS'], options: ['Linux', 'macOS', 'Windows'] }) - ); - }); - - it('should throw errors for filters', () => { - let filter = new Filter(); - let filter_error_file1 = { - platforms: [3, 4], - }; - let consoleSpy = spyOn(console, 'error'); - filter.deserialize(filter_error_file1); - expect(consoleSpy).toHaveBeenCalledWith('TypeError:', 3, '(', 'number', ')', 'is not a string'); - }); - - it('should throw errors for gradient', () => { - let filter = new Gradient(); - let filter_error_file1 = { - colors: [3, 4], - }; - let consoleSpy = spyOn(console, 'error'); - filter.deserialize(JSON.stringify(filter_error_file1)); - expect(consoleSpy).toHaveBeenCalledWith('TypeError:', 3, '(', 'number', ')', 'is not a color-string'); - }); - - it('should display warning dialog for major version mismatches', () => { - const dialogSpy = spyOn(component.dialog, 'open').and.returnValue({ afterClosed: () => of(true) }); - component.versionMismatchWarning('3.4', '4.4'); - expect(dialogSpy).toHaveBeenCalled(); - }); - - it('should display warning snackbar for minor version mismatches', () => { - spyOn(snackBar, 'open').and.callThrough(); - component.versionMismatchWarning('4.2', '4.5'); - expect(snackBar.open).toHaveBeenCalled(); - }); - - it('should read and open json file', waitForAsync(() => { - component.dataService.setUpURLs(MockData.mobileDomainData); - let mockedDocElement = document.createElement('input'); - mockedDocElement.id = 'uploader'; - mockedDocElement.value = 'test1'; - mockedDocElement.type = 'text'; - document.getElementById = jasmine.createSpy('uploader').and.returnValue(mockedDocElement); - const logSpy = spyOn(mockedDocElement, 'click'); - component.openUploadPrompt(); - expect(logSpy).toHaveBeenCalled(); - let blob = new Blob([JSON.stringify(MockLayers.layerFile2)], { type: 'text/json' }); - let file = new File([blob], 'layer-2.json'); - component.readJSONFile(file).then(() => { -======= it('should create and select new tab', () => { component.openTab('new test tab', null, false, false, true); ->>>>>>> develop expect(component.layerTabs.length).toEqual(1); expect(component.layerTabs[0].title).toEqual('new test tab'); expect(selectTabSpy).toHaveBeenCalledWith(component.layerTabs[0]); @@ -840,4 +743,4 @@ describe('TabsComponent', () => { }); })); }); -}); +}); \ No newline at end of file