Skip to content
Snippets Groups Projects
progress-bar.component.spec.ts 9.29 KiB
Newer Older
  • Learn to ignore specific revisions
  • /**
     * 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',
    
    François Agneray's avatar
    François Agneray committed
                description: 'My Instance description',
    
    François Agneray's avatar
    François Agneray committed
                scientific_manager: 'M. Dupont',
                instrument: 'Multiple',
                wavelength_domain: 'Visible',
    
    François Agneray's avatar
    François Agneray committed
                display: 10,
    
    François Agneray's avatar
    François Agneray committed
                files_path: 'files',
                public: true,
    
    François Agneray's avatar
    François Agneray committed
                portal_logo: 'logo.png',
                design_color: 'green',
                design_background_color: 'darker green',
                design_logo: 'path/to/logo',
                design_favicon: 'path/to/favicon',
    
    François Agneray's avatar
    François Agneray committed
                navbar_background_color: '#F8F9FA',
                navbar_border_bottom_color: '#DEE2E6',
                navbar_color_href: '#000000',
    
    François Agneray's avatar
    François Agneray committed
                navbar_font_family: 'Roboto, sans-serif',
                navbar_sign_in_btn_color: '#28A745',
                navbar_user_btn_color: '#7AC29A',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                progress_bar_title_color: '#000000',
    
                progress_bar_subtitle: 'Select a dataset, add criteria, select output columns and display the result.',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                progress_bar_circle_icon_color: '#CCCCCC',
                progress_bar_circle_icon_active_color: '#FFFFFF',
    
                progress_bar_text_color: '#91B2BF',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                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,
    
    François Agneray's avatar
    François Agneray committed
                back_to_portal: true,
    
    François Agneray's avatar
    François Agneray committed
                user_menu_enabled: true,
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                description: 'My Instance description',
    
    François Agneray's avatar
    François Agneray committed
                scientific_manager: 'M. Dupont',
                instrument: 'Multiple',
                wavelength_domain: 'Visible',
    
    François Agneray's avatar
    François Agneray committed
                display: 10,
    
    François Agneray's avatar
    François Agneray committed
                files_path: 'files',
                public: true,
    
    François Agneray's avatar
    François Agneray committed
                portal_logo: 'logo.png',
                design_color: 'green',
                design_background_color: 'darker green',
                design_logo: 'path/to/logo',
                design_favicon: 'path/to/favicon',
    
    François Agneray's avatar
    François Agneray committed
                navbar_background_color: '#F8F9FA',
                navbar_border_bottom_color: '#DEE2E6',
                navbar_color_href: '#000000',
    
    François Agneray's avatar
    François Agneray committed
                navbar_font_family: 'Roboto, sans-serif',
                navbar_sign_in_btn_color: '#28A745',
                navbar_user_btn_color: '#7AC29A',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                progress_bar_title_color: '#000000',
    
                progress_bar_subtitle: 'Select a dataset, add criteria, select output columns and display the result.',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                progress_bar_circle_icon_color: '#CCCCCC',
                progress_bar_circle_icon_active_color: '#FFFFFF',
    
                progress_bar_text_color: '#91B2BF',
    
    François Agneray's avatar
    François Agneray committed
                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',
    
    François Agneray's avatar
    François Agneray committed
                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,
    
    François Agneray's avatar
    François Agneray committed
                back_to_portal: true,
    
    François Agneray's avatar
    François Agneray committed
                user_menu_enabled: true,
    
    François Agneray's avatar
    François Agneray committed
                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';
    
    François Agneray's avatar
    François Agneray committed
            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' });