currentState: () => { if( pendingSearches > 0 ) { return 'SEARCHING'; } if( ax.object.path( scope, selectionModelKey, null ) ) { return 'SELECTED'; } if( ax.object.path( scope, queryStringKey, null ) ) { return 'NO_RESULTS'; } return 'IDLE'; }
eventBus.subscribe( 'didNavigate', event => { const query = ax.object.path( event, 'data.query', '' ); if( query && query.length > 0 ) { $scope.model.queryString = query; $scope.functions.startSearch(); } } );
it( 'updates the resource after receiving a patch with new values only', () => { testEventBus.publish( 'didUpdate.timeSeriesData', { resource: 'timeSeriesData', patches: specData.patchesWithNewValuesOnly } ); testEventBus.flush(); expect( widgetScope.api.updateWithOptions ).not.toHaveBeenCalled(); const modifiedChartModel = ax.object.deepClone( specData.expectedChartModel ); modifiedChartModel[ 0 ].values[ 0 ].y = 32; modifiedChartModel[ 1 ].values[ 2 ].y = 22; expect( widgetScope.model.data ).toEqual( modifiedChartModel ); } );
it( 'publishes a didUpdate event after the user changed a data value', () => { widgetScope.model.tableModel[ 1 ][ 1 ] = 11; widgetScope.$emit( 'axTableEditor.afterChange' ); const expectedResource = ax.object.deepClone( specData.originalResource ); expectedResource.series[ 0 ].values[ 0 ] = 11; const patch = patterns.json.createPatch( specData.originalResource, expectedResource ); expect( widgetEventBus.publish ) .toHaveBeenCalledWith( 'didUpdate.timeSeriesData', { resource: 'timeSeriesData', patches: patch }, jasmine.any( Object ) ); } );