Skip to content

Commit

Permalink
chore: Change updateDrag arg order for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy committed Sep 14, 2023
1 parent f4dd6cc commit 36e5455
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions v3/cypress/e2e/adornments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ context("Graph adornments", () => {
cy.get("[data-testid=graph-adornments-grid]")
.find("[data-testid=graph-adornments-grid__cell]").should("have.length", 1)
cy.get("[data-testid=adornment-wrapper]").should("have.length", 1)
cy.get("[data-testid=adornment-wrapper]").should("have.class", "fadeIn")
cy.get("[data-testid=adornment-wrapper]").should("have.class", "visible")
cy.get("[data-testid=graph-adornments-grid]").find("*[data-testid^=movable-value]").should("exist")
cy.get(".movable-value-label").should("have.length", 1)
cy.get(".movable-value-fill").should("have.length", 0)
Expand All @@ -140,7 +140,7 @@ context("Graph adornments", () => {
cy.wait(250)
movableValueButton.click()
cy.get("[data-testid=adornment-button-movable-value--remove]").click()
cy.get("[data-testid=adornment-wrapper]").should("have.class", "fadeOut")
cy.get("[data-testid=adornment-wrapper]").should("have.class", "hidden")
cy.get(".movable-value-label").should("have.length", 0)
cy.get(".movable-value-fill").should("have.length", 0)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("MovableValueModel", () => {
movableValue.setInitialValue(5, "{}")
movableValue.addValue(10)
movableValue.addValue(2)
movableValue.updateDrag(7, 0, "{}")
movableValue.updateDrag(7, "{}", 0)
expect(movableValue.valuesForKey("{}")).toEqual([7, 10, 2])
movableValue.endDrag(7, "{}", 0)
expect(movableValue.valuesForKey("{}")).toEqual([7, 10, 2])
Expand All @@ -52,7 +52,7 @@ describe("MovableValueModel", () => {
movableValue.setInitialValue(5, "{}")
movableValue.addValue(10)
movableValue.addValue(2)
movableValue.updateDrag(7, 0, "{}")
movableValue.updateDrag(7, "{}", 0)
expect(movableValue.sortedValues("{}")).toEqual([2, 7, 10])
movableValue.endDrag(7, "{}", 0)
expect(movableValue.sortedValues("{}")).toEqual([2, 7, 10])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ export const MovableValueModel = AdornmentModel
self.values.set(key, [])
self.addValue(aValue)
},
updateDrag(value: number, index: number, key: string) {
updateDrag(value: number, instanceKey: string, index: number) {
self.dragIndex = index
self.dragKey = key
self.dragKey = instanceKey
self.dragValue = value
},
endDrag(value: number, instanceKey: string, index: number) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const MovableValue = observer(function MovableValue (props: IProps) {
if ((preDragValue != null) && (newValue < axisMin || newValue > axisMax)) {
newValue = preDragValue

Check warning on line 146 in v3/src/components/graph/adornments/movable-value/movable-value.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/graph/adornments/movable-value/movable-value.tsx#L146

Added line #L146 was not covered by tests
}
model.updateDrag(newValue, index, instanceKey)
model.updateDrag(newValue, instanceKey, index)
refreshValue(newValue, index)

Check warning on line 149 in v3/src/components/graph/adornments/movable-value/movable-value.tsx

View check run for this annotation

Codecov / codecov/patch

v3/src/components/graph/adornments/movable-value/movable-value.tsx#L148-L149

Added lines #L148 - L149 were not covered by tests
}, [getValues, instanceKey, model, refreshValue, xAttrType, xCellCount, xScale, yCellCount, yScale])

Expand Down

0 comments on commit 36e5455

Please sign in to comment.