Skip to content

Numberline claud#2722

Draft
lbondaryk wants to merge 8 commits intomasterfrom
numberlineClaud
Draft

Numberline claud#2722
lbondaryk wants to merge 8 commits intomasterfrom
numberlineClaud

Conversation

@lbondaryk
Copy link
Contributor

This adds point value labels to the numberline when points are selected. Labels update when points are dragged and disappear when points are deselected. Some accessibility has been applied in terms of implementing tabbing through fields in the numberline tile.

- Zero tick mark always appears when min < 0 and max > 0
- Zero tick has bold styling even when not part of regular tick spacing
- Zero label only shows when zero falls on regular tick spacing
- Added Cypress tests for zero tick behavior
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 57.37705% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.23%. Comparing base (d5f8899) to head (ef7b453).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
.../plugins/numberline/components/numberline-tile.tsx 62.19% 31 Missing ⚠️
...umberline/components/editable-numberline-value.tsx 44.00% 14 Missing ⚠️
...rc/plugins/numberline/models/numberline-content.ts 22.22% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2722      +/-   ##
==========================================
- Coverage   86.78%   86.23%   -0.56%     
==========================================
  Files         811      811              
  Lines       43429    43529     +100     
  Branches    11115    11144      +29     
==========================================
- Hits        37689    37536     -153     
- Misses       5408     5655     +247     
- Partials      332      338       +6     
Flag Coverage Δ
cypress ?
cypress-regression 77.72% <57.37%> (+0.50%) ⬆️
cypress-smoke ?
jest 49.44% <40.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Jan 21, 2026

collaborative-learning    Run #17391

Run Properties:  status check failed Failed #17391  •  git commit ef7b453ca4: Fix Cypress test selector to avoid multiple element match.
Project collaborative-learning
Branch Review numberlineClaud
Run status status check failed Failed #17391
Run duration 48m 38s
Commit git commit ef7b453ca4: Fix Cypress test selector to avoid multiple element match.
Committer lbondaryk
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 4
Tests that did not run due to a developer annotating a test with .skip  Pending 4
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 149
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/functional/tile_tests/numberline_tool_spec.js • 1 failed test • Regression tests

View Output

Test Artifacts
Numberline Tile > Numberline Tile Test Replay Screenshots
Flakiness  xy_plot_tool_spec.js • 2 flaky tests • Regression tests

View Output

Test Artifacts
XYPlot Tool Tile > XYPlot Tool > XYPlot tool tile Test Replay Screenshots
XYPlot Tool Tile > XYPlot Tool > Test duplicating graph with an xy-plot (a.k.a. graph) Test Replay Screenshots
Flakiness  arrow_annotation_spec.js • 1 flaky test • Regression tests

View Output

Test Artifacts
Arrow Annotations (Sparrows) > can add arrows to xy plot tiles Test Replay Screenshots
Flakiness  geometry_tool_spec.js • 1 flaky test • Regression tests

View Output

Test Artifacts
Geometry Tool > works in all four modes Test Replay Screenshots

Copy link
Contributor

@tealefristoe tealefristoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The biggest issue here is that the cypress test is failing. The first new test is failing, so it's very possible multiple tests are failing afterwards.

But there are a lot of places where this should be adjusted. Part of the issue is that the nummberline tile is not very well structured to begin with, so building on top of it is going to exacerbate the mess. But also the AI seems to not understand how to keep things efficient, or separate new functionality between the model and component.

Looking over this, I feel like there are some easy, generic additions we could use for all CLUE prompts to improve the resulting code, such as "use variables defined in vars.scss rather than hard-coded color values whenever possible" and "make sure lines are limited to 121 characters at most".

Comment on lines +106 to +107
cy.get(".numberline-wrapper").click().type('{tab}');
numberlineToolTile.getValueLabel().should("exist");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.get(".numberline-wrapper").click().type('{tab}');
numberlineToolTile.getValueLabel().should("exist");
cy.get(".numberline-wrapper").click().type('{tab}');
numberlineToolTile.getValueLabel().should("exist");
numberlineToolTile.getValueLabelText().should("contain", "-2.00");

// Zero tick should exist even if not in regular spacing
cy.get(".numberline-tool-container .zero-tick").should("exist");
// Zero should not have a label since it's not part of regular tick spacing
numberlineToolTile.getAllNumberlineTicks().should('not.contain', '0');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cypress test is failing here, so nothing below is actually being run at this point.

Comment on lines +158 to +170
cy.log("will edit min value with keyboard");
// Click to show input
numberlineToolTile.getMinBox().click();
numberlineToolTile.getMinBoxInput().should('exist');
numberlineToolTile.getMinBoxInput().clear().type('-8{enter}');
numberlineToolTile.getMinBox().should('contain', '-8');

cy.log("will edit max value with keyboard");
// Click to show input
numberlineToolTile.getMaxBox().click();
numberlineToolTile.getMaxBoxInput().should('exist');
numberlineToolTile.getMaxBoxInput().clear().type('8{enter}');
numberlineToolTile.getMaxBox().should('contain', '8');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these tests redundant, since the range is already being changed above (like on lines 49 and 50)?

onFocus={handleFocus}
tabIndex={readOnly ? -1 : 0}
role="button"
aria-label={`${minOrMax === "min" ? "Minimum" : "Maximum"} value: ${value}. ${readOnly ? "" : "Press Enter to edit."}`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define const minOrMaxWord = minOrMax === "min" ? "Minimum" : "Maximum"; above, then use it here to make this line below the max length. You can also use minOrMaxWord on line 110 below.


.point-value-label-bg {
fill: $workspace-teal-light-8;
stroke: #949494;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stroke: #949494;
stroke: $charcoal-light-1;

Comment on lines +570 to +571
.attr("rx", 10)
.attr("ry", 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A constant should be used instead of hard coded 10 here.

Comment on lines +583 to +585
.attr("stroke", "#949494")
.attr("stroke-width", 1.5)
.style("pointer-events", "none");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could these be defined in css instead?

Comment on lines +20 to +29
it("only allows one selected point at a time", () => {
const content = NumberlineContentModel.create();
const point1 = content.createAndSelectPoint(1.0, false);
const point2 = content.createAndSelectPoint(3.0, false);

expect(content.points.size).toBe(2);
expect(content.selectedPoints[point1.id]).toBeUndefined();
expect(content.selectedPoints[point2.id]).toBe(point2);
expect(Object.keys(content.selectedPoints).length).toBe(1);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only want a single point to be selectable at a time, we should just take out the infrastructure that supports multiple points being selected.


it("clears all selected points", () => {
const content = NumberlineContentModel.create();
const point = content.createAndSelectPoint(2.0, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const point = content.createAndSelectPoint(2.0, false);
const _point = content.createAndSelectPoint(2.0, false);

To avoid a lint warning.

Comment on lines +93 to +104
it("can select points in order by position", () => {
const content = NumberlineContentModel.create();
const pointA = content.createNewPoint(3.0, false);
const pointB = content.createNewPoint(-2.0, false);
const pointC = content.createNewPoint(1.0, false);

// Points sorted by xValue: B(-2), C(1), A(3)
const sortedPoints = content.pointsArr.slice().sort((a, b) => a.xValue - b.xValue);
expect(sortedPoints[0].id).toBe(pointB.id);
expect(sortedPoints[1].id).toBe(pointC.id);
expect(sortedPoints[2].id).toBe(pointA.id);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't particularly useful. Once sortedPointsArr (or something similar) is added to NumberlineContentModel, it will make sense to test that.

- Fix Cypress tests: use exact equality checks, add missing assertions, remove redundant tests
- Replace hard-coded colors with vars.scss variables for consistency
- Fix lines exceeding 121 character limit by extracting repeated strings into variables
- Move logic to model layer: add sortedPointsArr, selectedPointsArr, and firstSelectedPoint views
- Improve efficiency: combine tick generation into single O(n) pass, eliminate redundant sorting
- Remove duplicate keyboard event handlers (HotKeys vs D3 handlers)
- Support moving all selected points with arrow keys (future-proofing for multi-select)
- Add kValueLabelBorderRadius constant, move inline styles to CSS

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Values very close to zero (between -0.005 and 0.005) now display as
"0.00" instead of potentially showing "-0.00".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Scoped .numberline-wrapper selector to .primary-workspace to ensure
only one element is matched when clicking/typing on the tile.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants