Commit Graph

1724 Commits

Author SHA1 Message Date
Aaron Dodson
bd7c86a909 chore: Improve code health of generator tests. (#8703) 2025-01-06 10:55:57 -08:00
Aaron Dodson
b8bb26f8fd fix: Fix serialization of the lists_split block. (#8702) 2025-01-06 10:54:33 -08:00
Christopher Allen
4680b4b5c1 test: Disable failing tests (#8677)
See issue #8676.
2024-12-04 09:30:22 -08:00
Aaron Dodson
24ab50d49d fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. (#8670)
* fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device.

* chore: Fix test failure.
2024-12-03 13:41:32 -08:00
Aaron Dodson
5870c66cf0 chore: Migrate ESLint configuration file to new flat format. (#8675)
* chore: rename .eslintrc.js to eslint.config.js

* chore: Rename eslint.config.js to eslint.config.mjs.

* refactor: Migrate ESLint config to new flat format.

* chore: Remove old per-directory and global ignore ESLint config files.

* fix: Allowlist JSDoc tag aliases.

* fix: Don't require @license in tests/*.

* fix: Add NodeJS globals to several files that run under Node.

* chore: Remove now-unneeded ESLint directives in core.

* chore: Remove invalid/unneeded ESLint directives.

* fix: Fix invalid use of `await` outside of an `async` function.

* fix: Improve screenshot error message.

* fix: Update ESLint config file to not warn on existing violations.

* chore: Remove suppressions of rules that weren't triggering.

* chore: Fix package-lock.json.
2024-12-03 12:40:48 -08:00
Aaron Dodson
61bbd7dbf6 chore: Remove underscores from private fields. (#8682)
* chore: Remove underscores from private fields.

* refactor: Use public APIs in tests where possible.
2024-12-02 11:33:05 -08:00
Aaron Dodson
aedcfd6da5 fix: Use a readonly textarea for non-editable comments. (#8632)
* fix: Use a readonly textarea for non-editable comments.

* chore: Run formatter.

* chore: remove old function definition
2024-11-04 09:43:17 -08:00
John Nesky
8d44a4d93a fix: Group field validator changes with field value changes. (#8589) 2024-09-24 16:09:41 -07:00
Ben Henning
05795a06ea Rename 'tidyUp' back to 'cleanUp'. 2024-09-03 23:13:50 +00:00
Ben Henning
fbafda3e4c Merge branch 'develop' into ensure-immovable-blocks-are-considered-during-workspace-tidying 2024-09-03 23:02:37 +00:00
Christopher Allen
2409123d66 refactor: Omit unused exception arguments from catch blocks (#8559)
Fixes #1770.
2024-09-03 15:27:40 +01:00
Christopher Allen
724828f689 refactor: Use arrow functions when calling Array.prototype.filter (#8557) 2024-08-30 17:23:23 +01:00
Christopher Allen
a7afda8343 fix(events): Simplify filter function, add new enqueueEvent function (#8539)
* docs(events): JSDoc improvments

* fix(filter): Introduce enqueueEvent; don't reorder in filter

  Remove the broken BlockChange event reordering code from filter.
  Instead, do necessary event reordering (correctly, this time)
  in a new enqueueEvent function used by fireInternal.

* chore(events): Deprecate forward parameter of filter

  Since we don't filter in undo any more, and filtering in reverse
  order causes problems, prepare to remove this opportunity for
  error.

* fix(events): Only merge adjacent events

  Simplify filter by having it consider only adjacent events in the
  queue for merging.

  Previously any events in the queue could potentially be merged if
  they were of suitable (typically identical) .type, even if other
  events had occurred between them (with the sole exception of
  BlockMove events, which would only be merged with adjacent
  events).  This could potentially result in replay failures during
  undo/redo/mirroring, though it is unknown whether any such
  problems occurred in practice.

* refactor(events): Tweaks

  - Use for…of loop where appropriate.
  - Make filter reason-merging code more concise.
  - Use arrow functions when calling Array.prototype.filter.

* chore(events): Fix typos for PR #8539.
2024-08-29 17:41:54 +01:00
John Nesky
095f29e274 fix: Detect if deleting shadow block affects selection highlight (#8533)
* fix: Detect if deleting shadow block affects selection highlight

* Use contains instead of descendsFrom for html consistency.

* Added tests.

* Removing and manually inlining new contains function.
2024-08-26 12:22:37 -07:00
Ben Henning
348a5b33b8 Addressed self-review comment. 2024-08-22 18:00:22 +00:00
Ben Henning
0413021b7c Auto-fix formatting issues to address CI failure. 2024-08-21 21:02:07 +00:00
Ben Henning
ca42a4b4fd Merge branch 'develop' into ensure-immovable-blocks-are-considered-during-workspace-tidying 2024-08-21 17:44:37 +00:00
Ben Henning
3a3e83fe44 Fix workspace clean up not considering immovables.
At a high-level, this change ensures that cleaning up a workspace
doesn't move blocks in a way that overlaps with immovable blocks. It
also adds missing testing coverage for both Rect (used for bounding box
calculations during workspace cleanup) and WorkspaceSvg (for verifying
the updated clean up functionality).

This also renames the clean up function to be 'tidyUp' since that better
suits what's happening (as opposed to other clean-up routines which are
actually deinitializing objects).
2024-08-21 17:41:38 +00:00
Christopher Allen
7ccdcc5cef refactor(events): introduce EventType enum in separate module (#8530)
* refactor(events): Use "export ... from" where applicable

* refactor(events): Introduce EventType enum

  Introduce an enum for the event .type values.  We can't actually
  use it as the type of the .type property on Abstract events,
  because we want to allow developers to add their own custom
  event types inheriting from this type, but at least this way we
  can be reasonably sure that all of our own event subclasses have
  distinct .type values—plus consistent use of enum syntax
  (EventType.TYPE_NAME) is probably good for readability overall.

  Put it in a separate module from the rest of events/utils.ts
  because it would be helpful if event utils could use

      event instanceof SomeEventType

  for type narrowing but but at the moment most events are in
  modules that depend on events/utils.ts for their .type
  constant, and although circular ESM dependencies should work
  in principle there are various restrictions and this
  particular circularity causes issues at the moment.

  A few of the event classes also depend on utils.ts for fire()
  or other functions, which will be harder to deal with, but at
  least this commit is win in terms of reducing the complexity
  of our dependencies, making most of the Abstract event subclass
  module dependent on type.ts, which has no imports, rather than
  on utils.ts which has multiple imports.
2024-08-20 08:36:33 +01:00
Christopher Allen
ce22f42868 chore: Organise imports (#8527)
* chore(deps): Add pretter-plugin-organize-imports

* chore: Remove insignificant blank lines in import sections

  Since prettier-plugin-organize-imports sorts imports within
  sections separated by blank lines, but preserves the section
  divisions, remove any blank lines that are not dividing imports
  into meaningful sections.

  Do not remove blank lines separating side-effect-only imports
  from main imports.

* chore: Remove unneded eslint-disable directives

* chore: Organise imports
2024-08-15 03:16:14 +01:00
abhinavjha0239
ec8f9c8589 chore: removed the whole Drag category from the browser test (#8478)
* fix: removed the whole Drag category from the blocks

* fix: added comment according to reviewer

* fix: added comment according to reviewer

* fix: added comment according to reviewer
2024-08-14 11:17:28 -07:00
dependabot[bot]
f57ef73aaf chore(deps): bump @typescript-eslint/eslint-plugin from 7.17.0 to 8.0.1 (#8479)
* chore(deps): bump @typescript-eslint/eslint-plugin from 7.17.0 to 8.0.1

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.17.0 to 8.0.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.0.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: lint plugin versions

* chore: fix linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Beka Westberg <bwestberg@google.com>
2024-08-14 09:10:34 -07:00
John Nesky
cd31edbd9a fix: Update dev-tools and remove toolbox category tests Colour and Angles. (#8457) 2024-08-05 12:02:58 -07:00
John Nesky
40c6d9c490 fix: Enable blocks if user can't manually enable them. (#8354)
* fix: Enable blocks if user can't manually enable them.

* Only change the affected test method.
2024-07-22 09:21:51 -07:00
dependabot[bot]
8cad97a214 chore(deps): bump @hyperjump/json-schema from 1.6.7 to 1.9.3 (#8363)
* chore(deps): bump @hyperjump/json-schema from 1.6.7 to 1.9.3

  Bumps [@hyperjump/json-schema](https://github.com/hyperjump-io/json-schema) from 1.6.7 to 1.9.3.
  - [Commits](https://github.com/hyperjump-io/json-schema/compare/v1.6.7...v1.9.3)

  ---
  updated-dependencies:
  - dependency-name: "@hyperjump/json-schema"
    dependency-type: direct:development
    update-type: version-update:semver-minor
  ...

  Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): Add dev dependency on @hyperjump/browser

  @hyperjump/json-schema (v1.7.0 and later) depends upon
  @hyperjump/browser, but fails to declare it as a dependency,
  only listing it as a peer dependency, so said package must be
  installed separately.

* fix(tests): Use BASIC output as DETAILED is no longer supported

  See issue hyperjump-io/json-chema#68 for additional info.

* feat(tests): Add more informational output in case of test failure

  Since the BASIC output of the schema verifier is (slightly) less
  helpful than the old DETAILED output, add an additional output
  containing the first invalid path, e.g.:

      #/9.3.0/0/exports/textToDom/newModule

  in the results object returned by validate, since this is the
  most useful part of that info.

  Also use console.error and console.info instead of console.log
  where appropriate.

* chore(tests): Format

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2024-07-19 11:22:07 +01:00
John Nesky
9a0619aa2a fix: Drag and Resize events for workspace comments (#8217)
* feat: Added a comment_drag event.

* Add workspace comment resize events.

* Addressing PR feedback.

* Fixed chai imports in new test files.

* Addressing more PR feedback.
2024-06-26 12:16:56 -07:00
dependabot[bot]
bfb5b1dd49 chore(deps): Bump chai from 4.3.10 to 5.1.1 (#8092)
* chore(deps): Bump chai from 4.3.10 to 5.1.1

  Bumps [chai](https://github.com/chaijs/chai) from 4.3.10 to 5.1.1.
  - [Release notes](https://github.com/chaijs/chai/releases)
  - [Changelog](https://github.com/chaijs/chai/blob/main/History.md)
  - [Commits](https://github.com/chaijs/chai/compare/v4.3.10...v5.1.1)

  ---
  updated-dependencies:
  - dependency-name: chai
    dependency-type: direct:development
    update-type: version-update:semver-major
  ...

  Signed-off-by: dependabot[bot] <support@github.com>

* fix(tests): Migrate all usage of chai to ESM (#8216)

* fix(tests): Migrate node tests from CJS to ESM

  This allows us to import (rather than require) chai, fixing failures
  caused by that package dropping suppport for CJS in chai v5.0.0.

* fix(tests): Have mocha tests directly import chai

  Previously they relied on obtaining it from the global scope, but it's
  better if imports are explicit.

* fix(tests): Remove broken load of chai as script

  Chai v5.0.0 no longer supports being loaded as a script, so this did
  nothing but emit an syntax error message on the console.

* fix(tests): Migrate browser tests from CJS to ESM

  This allows us to import (rather than require) chai, fixing failures
  caused by chai no longer supporting CJS.

* chore(tests): format

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2024-06-17 16:48:21 +01:00
Mark Friedman
5881ce32c1 fix: change which element keydown is bound to from document to injection div (#8188)
* Change which element keydown is bound to

* Modify keydown tests

* Use browserEvents.conditionalBind()

* Remove commented out code.
2024-05-31 23:19:46 +01:00
Sampada Bhujel
260bc6f678 feat(tests): Browser test helper to get workspace svg root (#8166)
* feat: Add helper to get the svg root of workspace to be clicked on

* feat: Add helper to get the mutator svg root to be clicked on

* fix: fix style format issue
2024-05-23 15:52:00 +01:00
Maribeth Bottorff
3ac2fb9f82 chore: update metadata for v11 release (#8163) 2024-05-20 11:33:52 -07:00
Beka Westberg
69db8a63d6 fix: comment size not respecting collapsed-ness (#8136)
* fix: comment size not respecting collapsed-ness

* chore: fix tests the only way I know how, by adding explicit clock ticks
2024-05-17 13:23:13 -07:00
Maribeth Bottorff
53cc12da77 chore: fix playground context menu (#8139) 2024-05-17 09:48:41 -07:00
Beka Westberg
280568e66e chore: rename airstrike -> scatter (#8130) 2024-05-16 11:20:43 -07:00
Maribeth Moffatt
0255c580f7 Merge branch 'develop' into merge-v11 2024-05-13 11:20:39 -07:00
Maribeth Bottorff
28ac0c4473 fix: improve types in FieldRegistry (#8062)
* fix: improve types in FieldRegistry

* chore: tsdoc
2024-05-10 14:14:50 -07:00
Beka Westberg
c704d5a887 revert: "feat: allow the dialog methods to take in extra parameters (#8084)" (#8085)
This reverts commit 278006b5f8.
2024-05-10 11:12:15 -07:00
Beka Westberg
278006b5f8 feat: allow the dialog methods to take in extra parameters (#8084)
* feat: allow prompt to take in additional params

* feat: allow confirm tot ake in extra args

* feat: allow alert dialog to take in extra parameters

* chore: add tests for dialog methods
2024-05-08 10:10:09 -07:00
John Nesky
171befa746 fix!: Only fire intermediate events when editing input with invalid text. (#8054)
* fix: Fire intermediate events only when editing text input.

* Prefix unused arg with underscore.

* Fix tests.
2024-05-02 18:57:57 -07:00
Beka Westberg
69c5557e4f chore: fix comments being resizable when readonly (#8043) 2024-04-19 11:15:56 -07:00
John Nesky
cee7f916bb feat!: Invalid Blocks (#7958)
* feat: Invalid Blocks

* Rename the new json property from invalid to invalidReasons.

* Merged isValid into isEnabled.

* Minor fixes.

* More minor fixes.

* Reverting some stuff that didn't need to change.

* Addressing PR feedback.

* Update the BlockInfo interface to match State.

* Make BlockChange.disabledReason private.
2024-04-17 19:47:51 -07:00
Beka Westberg
7d8f88a4f1 chore: delete old comments (#8038)
* chore!: delete old comment classes and references

* chore: PR comments
2024-04-17 14:33:36 -07:00
Beka Westberg
e21bb99ff1 feat!: Add context menu options for workspace comments (#8035)
* feat: add context menu support and migrate easy options

* feat: pass events to context menu options

* chore: migrate final comment context menu option

* feat: add exports for comment context menu items

* chore: PR comments
2024-04-17 13:02:53 -07:00
Beka Westberg
d6744758f8 chore: add webdriver tests for workspace comments (#7954)
* chore: add collapse and uncollapse tests

* chore: add typing test

* chore: add resizing test

* chore: add delete tests

* chore: add better assertion messages

* chore: copyright year
2024-04-05 16:18:01 +00:00
Beka Westberg
fd177358ea feat: comment collapse event (#7949)
* feat: define comment collapse event

* feat: add firing collapse events

* chore: add round-trip test

* chore: add tests for firing collapse events

* chore: format
2024-04-04 15:48:34 -07:00
Beka Westberg
ed403d0b77 feat!: change gestures to look at selected when dragging (#7991)
* feat: change gestures to look at selected when dragging

* chore: fix tests

* chore: format

* chore: PR comments
2024-04-04 08:52:43 -07:00
Beka Westberg
e75a4fb1d3 fix: comment move and change events (#7947)
* fix: comment move event

* feat: add support for a drag reason

* fix: comment change events

* chore: add tests for move and change events
2024-04-03 12:58:04 -07:00
Maribeth Bottorff
b7cdeffccd chore: merge develop into rc/v11 2024-04-01 14:57:19 -07:00
Beka Westberg
2fa6f5b954 fix: comment icon interface re serialization (#7964)
* fix: comment icon interface re serialization

* chore: fix test
2024-04-01 14:34:48 -07:00
Beka Westberg
63eb4ecb2a fix: comment create and delete events (#7945)
* chore: switch events to use new comment class

* fix: switch create and delete events to use JSON

* work on getting new comments to fire events

* chore: fixup tests

* chore: rename workspace comment test to comment view test

* chore: add tests for firing events

* chore: remove TODO
2024-04-01 21:33:50 +00:00
Maribeth Bottorff
6767717d0b feat: allow duplicate registry values (#7988) 2024-04-01 14:13:25 -07:00