/** * This file is part of Anis Client. * * @copyright Laboratoire d'Astrophysique de Marseille / CNRS * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ProgressBarComponent } from './progress-bar.component'; import { RouterTestingModule } from '@angular/router/testing'; describe('[Instance][Search][Component] ProgressBarComponent', () => { let component: ProgressBarComponent; let fixture: ComponentFixture<ProgressBarComponent>; beforeEach(() => { TestBed.configureTestingModule({ declarations: [ProgressBarComponent], imports: [RouterTestingModule] }); fixture = TestBed.createComponent(ProgressBarComponent); component = fixture.componentInstance; }); it('should create the component', () => { expect(component).toBeTruthy(); }); it('#getStepClass() should return correct step class', () => { let style = component.getStepClass(); expect(style).toBe('datasetStep'); component.currentStep = 'dataset'; style = component.getStepClass(); expect(style).toBe('datasetStep'); component.currentStep = 'criteria'; style = component.getStepClass(); expect(style).toBe('criteriaStep'); component.currentStep = 'output'; style = component.getStepClass(); expect(style).toBe('outputStep'); component.currentStep = 'result'; style = component.getStepClass(); expect(style).toBe('resultStep'); }); it('#getNavItemAStyle() should return link color theme', () => { component.instance = { name: 'myInstance', label: 'My Instance', description: 'My Instance description', scientific_manager: 'M. Dupont', instrument: 'Multiple', wavelength_domain: 'Visible', display: 10, data_path: 'data/path', files_path: 'files', public: true, portal_logo: 'logo.png', design_color: 'green', design_background_color: 'darker green', design_logo: 'path/to/logo', design_favicon: 'path/to/favicon', navbar_background_color: '#F8F9FA', navbar_border_bottom_color: '#DEE2E6', navbar_color_href: '#000000', navbar_font_family: 'Roboto, sans-serif', navbar_sign_in_btn_color: '#28A745', navbar_user_btn_color: '#7AC29A', footer_background_color: '#F8F9FA', footer_border_top_color: '#DEE2E6', footer_text_color: '#000000', footer_logos: null, family_border_color: '#DFDFDF', family_header_background_color: '#F7F7F7', family_title_color: '#007BFF', family_title_bold: false, family_background_color: '#FFFFFF', family_color: '#212529', progress_bar_title: 'Dataset search', progress_bar_title_color: '#000000', progress_bar_subtitle: 'Select a dataset, add criteria, select output columns and display the result.', progress_bar_subtitle_color: '#6C757D', progress_bar_step_dataset_title: 'Dataset selection', progress_bar_step_criteria_title: 'Search criteria', progress_bar_step_output_title: 'Output columns', progress_bar_step_result_title: 'Result table', progress_bar_color: '#E9ECEF', progress_bar_active_color: '#7AC29A', progress_bar_circle_color: '#FFFFFF', progress_bar_circle_icon_color: '#CCCCCC', progress_bar_circle_icon_active_color: '#FFFFFF', progress_bar_text_color: '#91B2BF', result_header_background_color: '#E9ECEF', result_header_text_color: '#000000', result_header_btn_color: '#007BFF', result_header_btn_hover_color: '#0069D9', result_header_btn_text_color: '#FFFFFF', result_datatable_bordered: true, result_datatable_border_color: '#DEE2E6', result_datatable_header_background_color: '#FFFFFF', result_datatable_header_text_color: '#000000', result_datatable_rows_background_color: '#FFFFFF', result_datatable_rows_text_color: '#000000', result_datatable_sorted_color: '#C5C5C5', result_datatable_sorted_active_color: '#000000', result_datatable_link_color: '#007BFF', result_datatable_link_hover_color: '#0056B3', result_datatable_rows_selected_color: '#7AC29A', samp_enabled: true, back_to_portal: true, user_menu_enabled: true, search_by_criteria_allowed: true, search_by_criteria_label: 'Search', search_multiple_allowed: true, search_multiple_label: 'Search multiple', search_multiple_all_datasets_selected: false, documentation_allowed: true, documentation_label: 'Documentation', nb_dataset_families: 1, nb_datasets: 2 }; component.currentStep = 'a'; expect(component.getNavItemAStyle('b', false)).toEqual({"color": "#91B2BF"}); expect(component.getNavItemAStyle('b', true)).toEqual({ color: '#7AC29A' }); }); it('#getNavItemIconCircleStyle() should return circle color theme', () => { component.instance = { name: 'myInstance', label: 'My Instance', description: 'My Instance description', scientific_manager: 'M. Dupont', instrument: 'Multiple', wavelength_domain: 'Visible', display: 10, data_path: 'data/path', files_path: 'files', public: true, portal_logo: 'logo.png', design_color: 'green', design_background_color: 'darker green', design_logo: 'path/to/logo', design_favicon: 'path/to/favicon', navbar_background_color: '#F8F9FA', navbar_border_bottom_color: '#DEE2E6', navbar_color_href: '#000000', navbar_font_family: 'Roboto, sans-serif', navbar_sign_in_btn_color: '#28A745', navbar_user_btn_color: '#7AC29A', footer_background_color: '#F8F9FA', footer_border_top_color: '#DEE2E6', footer_text_color: '#000000', footer_logos: null, family_border_color: '#DFDFDF', family_header_background_color: '#F7F7F7', family_title_color: '#007BFF', family_title_bold: false, family_background_color: '#FFFFFF', family_color: '#212529', progress_bar_title: 'Dataset search', progress_bar_title_color: '#000000', progress_bar_subtitle: 'Select a dataset, add criteria, select output columns and display the result.', progress_bar_subtitle_color: '#6C757D', progress_bar_step_dataset_title: 'Dataset selection', progress_bar_step_criteria_title: 'Search criteria', progress_bar_step_output_title: 'Output columns', progress_bar_step_result_title: 'Result table', progress_bar_color: '#E9ECEF', progress_bar_active_color: '#7AC29A', progress_bar_circle_color: '#FFFFFF', progress_bar_circle_icon_color: '#CCCCCC', progress_bar_circle_icon_active_color: '#FFFFFF', progress_bar_text_color: '#91B2BF', result_header_background_color: '#E9ECEF', result_header_text_color: '#000000', result_header_btn_color: '#007BFF', result_header_btn_hover_color: '#0069D9', result_header_btn_text_color: '#FFFFFF', result_datatable_bordered: true, result_datatable_border_color: '#DEE2E6', result_datatable_header_background_color: '#FFFFFF', result_datatable_header_text_color: '#000000', result_datatable_rows_background_color: '#FFFFFF', result_datatable_rows_text_color: '#000000', result_datatable_sorted_color: '#C5C5C5', result_datatable_sorted_active_color: '#000000', result_datatable_link_color: '#007BFF', result_datatable_link_hover_color: '#0056B3', result_datatable_rows_selected_color: '#7AC29A', samp_enabled: true, back_to_portal: true, user_menu_enabled: true, search_by_criteria_allowed: true, search_by_criteria_label: 'Search', search_multiple_allowed: true, search_multiple_label: 'Search multiple', search_multiple_all_datasets_selected: false, documentation_allowed: true, documentation_label: 'Documentation', nb_dataset_families: 1, nb_datasets: 2 }; component.currentStep = 'a'; expect(component.getNavItemIconCircleStyle('a', false)).toEqual({ 'background-color': '#7AC29A', 'border-color': '#7AC29A', 'color': '#FFFFFF' }); expect(component.getNavItemIconCircleStyle('b', true)).toEqual({ 'color': '#7AC29A', 'border-color': '#7AC29A', 'background-color': '#FFFFFF' }); }); });