-
Notifications
You must be signed in to change notification settings - Fork 5
Fix/slider value #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix/slider value #242
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ce3351b
add api to get slider values
TrevorBurgoyne cb5bd89
bump version
TrevorBurgoyne cb48bda
fix typing
TrevorBurgoyne 1361a40
add e2e tests
TrevorBurgoyne 5ebeadb
apply suggestion from review
TrevorBurgoyne 3fdb890
dont include delete class in filter
TrevorBurgoyne ccd0cd3
apply suggestion
TrevorBurgoyne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,2 @@ | ||
| ## Tasks | ||
| - [x] Read the discussion in issue [#159](https://github.com/SenteraLLC/ulabel/issues/159) | ||
| - [x] Implement a vertex deletion keybind for polygon and polyline spatial types it should: | ||
| - [x] Delete the vertex when pressed when hovering over it such that the edit suggestion is showing | ||
| - [x] Delete the vertex when pressed when dragging/editing the vertex | ||
| - [x] For polylines, if only one point remains in the polyline, it should delete the polyline | ||
| - [x] For polygons, if fewer than 3 points remain in a polygon layer, the layer should be removed | ||
| - [x] Add a test for the keybind in keybind-functionality.spec.js | ||
| - [x] Update the api_spec and changelog | ||
|
|
||
| - | ||
TrevorBurgoyne marked this conversation as resolved.
Show resolved
Hide resolved
TrevorBurgoyne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| export const ULABEL_VERSION = "0.23.2"; | ||
| export const ULABEL_VERSION = "0.23.3"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // End-to-end tests for slider public API methods | ||
| import { test, expect } from "./fixtures"; | ||
| import { wait_for_ulabel_init } from "../testing-utils/init_utils"; | ||
|
|
||
| test.describe("Slider Public API", () => { | ||
| test.describe("get_keypoint_slider_value", () => { | ||
| test("should return default keypoint slider value after init", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_keypoint_slider_value()); | ||
|
|
||
| // Default keypoint_slider_default_value is 0, so the slider should be at 0 | ||
| expect(value).toBe(0); | ||
| }); | ||
|
|
||
| test("should reflect value after moving the slider", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| // Set the slider to 75 (out of 100) via the DOM | ||
| await page.evaluate(() => { | ||
| const slider = document.querySelector("#keypoint-slider"); | ||
| slider.value = "75"; | ||
| slider.dispatchEvent(new Event("input", { bubbles: true })); | ||
| }); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_keypoint_slider_value()); | ||
|
|
||
| // Value should be 0.75 (75 / 100) | ||
| expect(value).toBe(0.75); | ||
| }); | ||
|
|
||
| test("should return a number between 0 and 1", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_keypoint_slider_value()); | ||
|
|
||
| expect(typeof value).toBe("number"); | ||
| expect(value).toBeGreaterThanOrEqual(0); | ||
| expect(value).toBeLessThanOrEqual(1); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe("get_distance_filter_value", () => { | ||
| test("should return default distance filter value after init", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_distance_filter_value()); | ||
|
|
||
| // Should have at least the closest_row key with the default distance of 40 | ||
| expect(value).not.toBeNull(); | ||
| expect(value.closest_row).toBeDefined(); | ||
| expect(value.closest_row.distance).toBe(40); | ||
| }); | ||
|
|
||
| test("should reflect value after moving the slider", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| // Set the distance filter slider to 200 | ||
| await page.evaluate(() => { | ||
| const slider = document.querySelector("#filter-row-distance-closest_row"); | ||
| slider.value = "200"; | ||
| slider.dispatchEvent(new Event("input", { bubbles: true })); | ||
| }); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_distance_filter_value()); | ||
|
|
||
| expect(value.closest_row.distance).toBe(200); | ||
| }); | ||
|
|
||
| test("should return an object with closest_row key", async ({ page }) => { | ||
| await wait_for_ulabel_init(page); | ||
|
|
||
| const value = await page.evaluate(() => window.ulabel.get_distance_filter_value()); | ||
|
|
||
| expect(typeof value).toBe("object"); | ||
| expect(value).toHaveProperty("closest_row"); | ||
| expect(typeof value.closest_row.distance).toBe("number"); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.