templates/assets/js/navigation.js
function (filteringButtons, scenarios, steps) {
            var self = this,
                btnState;
            for (var k = 0; k < filteringButtons.length; k++) {
                filteringButtons[k].addEventListener('click', function () {

                    btnState = this.dataset.state;
                    self.displayAllFeatures();

                    if (btnState !== 'steps') {
                        self.removeActiveClass(filteringButtons);
                        this.classList.add('active');
                        self.hideSteps(steps);
                    }

                    switch (btnState) {

                        case 'all':
                            self.displayAllScenarios(scenarios);
                            break;
                        case 'chart':
                            app.chart.toggleChart();
                            self.displayAllScenarios(scenarios);
                            break;
                        case 'steps':
                            if (self.currentView === 'failed') {
                                self.toggleStepsVisibilities('.scenario.failed .step', 'passed');
                            }
                            else if (self.currentView === 'passed') {
                                self.toggleStepsVisibilities('.scenario.passed .step', 'failed');
                            } else {
                                self.displayAllScenarios(scenarios);
                                self.toggleSteps(steps);
                            }
                            break;
                        default:
                            self.filterScenarios(btnState);
                            break;
                    }
                }, false);
            }
        }
function (filteringButtons, scenarios, steps) {
            var self = this,
                btnState;
            for (var k = 0; k < filteringButtons.length; k++) {
                filteringButtons[k].addEventListener('click', function () {

                    btnState = this.dataset.state;
                    self.displayAllFeatures();

                    if (btnState !== 'steps') {
                        self.removeActiveClass(filteringButtons);
                        this.classList.add('active');
                        self.hideSteps(steps);
                    }

                    switch (btnState) {

                        case 'all':
                            self.displayAllScenarios(scenarios);
                            break;
                        case 'chart':
                            app.chart.toggleChart();
                            self.displayAllScenarios(scenarios);
                            break;
                        case 'steps':
                            if (self.currentView === 'failed') {
                                self.toggleStepsVisibilities('.scenario.failed .step', 'passed');
                            }
                            else if (self.currentView === 'passed') {
                                self.toggleStepsVisibilities('.scenario.passed .step', 'failed');
                            } else {
                                self.displayAllScenarios(scenarios);
                                self.toggleSteps(steps);
                            }
                            break;
                        default:
                            self.filterScenarios(btnState);
                            break;
                    }
                }, false);
            }
        }
function ( filteringButtons , scenarios , steps ) { var self = this , btnState ; for ( var k = 0 ; k < filteringButtons . length ; k ++ ) { filteringButtons [ k ] . addEventListener ( 'click' , function ( ) { btnState = this . dataset . state ; self . displayAllFeatures ( ) ; if ( btnState !== 'steps' ) { self . removeActiveClass ( filteringButtons ) ; this . classList . add ( 'active' ) ; self . hideSteps ( steps ) ; } switch ( btnState ) { case 'all' : self . displayAllScenarios ( scenarios ) ; break ; case 'chart' : app . chart . toggleChart ( ) ; self . displayAllScenarios ( scenarios ) ; break ; case 'steps' : if ( self . currentView === 'failed' ) { self . toggleStepsVisibilities ( '.scenario.failed .step' , 'passed' ) ; } else if ( self . currentView === 'passed' ) { self . toggleStepsVisibilities ( '.scenario.passed .step' , 'failed' ) ; } else { self . displayAllScenarios ( scenarios ) ; self . toggleSteps ( steps ) ; } break ; default : self . filterScenarios ( btnState ) ; break ; } } , false ) ; } }
Run appropriate action depending on button state

@param filteringButtons indicate the navigation buttons

@param scenarios indicate all scenarios in report

@param steps indicate all steps in report
Run appropriate action depending on button state