Skip to content

Commit

Permalink
Track current page url in exports
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjmaclean committed Oct 18, 2021
1 parent 151cb3b commit 7c6dd6c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cypress/integration/ct-zero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ context('statistics-dashboard', () => {
const ctZeroParam = 'content-tier-zero=true';
const ctZeroFilterParam = DimensionName.contentTier;
const selCtrlCTZero = '[for=ctZero]';
const selFilterLabel = '.checkbox-label';
const selFilterLabel = '.checkbox-labelled.contentTier .checkbox-label';

const selFilterOpener = '.opener-name';
const urlDefault = `/data/${DimensionName.country}`;
const urlCTZero = `${urlDefault}?content-tier-zero=true`;
Expand Down
36 changes: 36 additions & 0 deletions cypress/integration/export.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { DimensionName } from '../../src/app/_models';

context('statistics-dashboard', () => {

const force = { force : true };
const selExports = '.export.active';
const selOpener = '.export-opener';
const selText = '.copy-source';

const urlDefault = `/data/${DimensionName.country}`;
const urlFiltered = `${urlDefault}?provider=Athena`;

describe('exports', () => {

it('should show and hide the exports panel', () => {
cy.visit(urlDefault);
cy.get(selExports).should('have.length', 0);
cy.get(selOpener).should('have.length', 1);
cy.get(selOpener).click(force);
cy.get(selExports).should('have.length', 1);
cy.get(selOpener).click(force);
cy.get(selExports).should('have.length', 0);
});

it('should be aware of the current page url', () => {
cy.visit(urlDefault);
cy.get(selOpener).click(force);
cy.get(selText).invoke('val').should('contain', urlDefault);
cy.get(selText).invoke('val').should('not.contain', urlFiltered);
cy.visit(urlFiltered);
cy.get(selOpener).click(force);
cy.get(selText).invoke('val').should('contain', urlFiltered);
});

});
});
5 changes: 4 additions & 1 deletion src/app/export/export.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { ExportCSVService, ExportPDFService } from '../_services';
styleUrls: ['./export.component.scss']
})
export class ExportComponent {
@Input() currentUrl = window.location.href;
get currentUrl(): string {
return window.location.href;
}

@Input() getGridData: () => FmtTableData;
@Input() getChartData: () => Promise<string>;
@ViewChild('contentRef') contentRef: ElementRef;
Expand Down

0 comments on commit 7c6dd6c

Please sign in to comment.