Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoldowsky committed Sep 16, 2024
1 parent 858954b commit f32d814
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions cypress/e2e/functional/tile_tests/bar_graph_tile_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ context('Bar Graph Tile', function () {
clueCanvas.getRedoTool().click();
barGraph.getYAxisLabel().should('have.text', 'Counts of something');

// ESC key should cancel the edit
barGraph.getYAxisLabelButton().click();
barGraph.getYAxisLabelEditor().should('be.visible').type(' abandon this{esc}');
barGraph.getYAxisLabelEditor().should('not.exist');
barGraph.getYAxisLabel().should('have.text', 'Counts of something');

// Should not be able to change Y axis label in read-only views
barGraph.getYAxisLabelButton(workspaces[1]).click();
barGraph.getYAxisLabelEditor(workspaces[1]).should('not.exist');
barGraph.getYAxisLabelButton(workspaces[2]).click();
barGraph.getYAxisLabelEditor(workspaces[2]).should('not.exist');

cy.log('Duplicate tile');
clueCanvas.getDuplicateTool().click();
for (const workspace of workspaces) {
Expand Down Expand Up @@ -220,6 +232,16 @@ context('Bar Graph Tile', function () {

cy.log('Change Sort By');
barGraph.getSortByMenuButton().should('have.text', 'None');

// Cannot change sort by in read-only views
for (const workspace of workspaces.slice(1)) {
barGraph.getSortByMenuButton(workspace).click();
barGraph.getChakraMenuItem(workspace).should('have.length', 3);
barGraph.getChakraMenuItem(workspace).eq(1).should('have.text', 'y'); // menu exists
barGraph.getChakraMenuItem(workspace).should('be.disabled'); // all options disabled
barGraph.getSortByMenuButton(workspace).click(); // close menu
}

barGraph.getSortByMenuButton().click();
barGraph.getChakraMenuItem().should('have.length', 3);
barGraph.getChakraMenuItem().eq(1).should('have.text', 'y').click();
Expand Down Expand Up @@ -250,6 +272,14 @@ context('Bar Graph Tile', function () {
}

cy.log('Change Category');

// Cannot change category in read-only views
for (const workspace of workspaces.slice(1)) {
barGraph.getXAxisPulldownButton(workspace).click();
barGraph.getChakraMenuItem(workspace).should('have.length', 3).and('be.disabled');
barGraph.getXAxisPulldownButton(workspace).click(); // close menu
}

barGraph.getXAxisPulldownButton().click();
barGraph.getChakraMenuItem().should('have.length', 3);
barGraph.getChakraMenuItem().eq(1).should('have.text', 'y').click();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/graph/graph-registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { GraphWrapperComponent } from "./components/graph-wrapper-component";
import { createGraphModel, GraphModel } from "./models/graph-model";
import { updateGraphContentWithNewSharedModelIds, updateGraphObjectWithNewSharedModelIds }
from "./utilities/graph-utils";
import { AppConfigModelType } from "../../models/stores/app-config-model";
import { AppConfigModelType } from "../../models/stores/app-config-model";

import Icon from "./assets/graph-icon.svg";
import HeaderIcon from "./assets/graph-tile-id.svg";
Expand Down

0 comments on commit f32d814

Please sign in to comment.