Skip to content

Commit

Permalink
Merge pull request #136 from jcuenod/fix/toggle-forced
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpyder authored Aug 30, 2024
2 parents 7f2cf0a + 67961b4 commit 495bdb3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
## main


#### :boom: Breaking Change

- Corrected return type of `getPropertyValue` for CSS style attributes (it's nullable and now returns an option).
- Corrected signature of `toggleForced` (for `Dom.domTokenList`) to accept a bool denoting whether to toggle the class on or off.

#### :bug: Bug Fix

Expand Down
7 changes: 5 additions & 2 deletions lib/js/tests/Webapi/Dom/Webapi__Dom__DomTokenList__test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ var supports = tlist.supports("my-class");

var toggle = tlist.toggle("my-class");

var toggleForced = tlist.toggle("my-class", true);
var toggleForced_true = tlist.toggle("my-class", true);

var toggleForced_false = tlist.toggle("my-class", false);

var toString = tlist.toString();

Expand All @@ -46,7 +48,8 @@ exports.item = item$1;
exports.contains = contains;
exports.supports = supports;
exports.toggle = toggle;
exports.toggleForced = toggleForced;
exports.toggleForced_true = toggleForced_true;
exports.toggleForced_false = toggleForced_false;
exports.toString = toString;
exports.value = value;
exports.setValue = setValue;
Expand Down
2 changes: 1 addition & 1 deletion src/Webapi/Dom/Webapi__Dom__DomTokenList.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type t = Dom.domTokenList
@send external replace: (t, string, string) => unit = "replace" /* experimental */
@send external supports: (t, string) => bool = "supports" /* experimental, Content Management Level 1 */
@send external toggle: (t, string) => bool = "toggle"
@send external toggleForced: (t, string, @as(json`true`) _) => bool = "toggle"
@send external toggleForced: (t, string, bool) => bool = "toggle"
@send external toString: t => string = "toString"
/* values: iterator API, should have language support */

Expand Down
3 changes: 2 additions & 1 deletion tests/Webapi/Dom/Webapi__Dom__DomTokenList__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ tlist->removeMany(["my-class", "my-other-class"])
tlist->replace("my-class", "my-other-class")
let supports: bool = tlist->supports("my-class")
let toggle: bool = tlist->toggle("my-class")
let toggleForced: bool = tlist->toggleForced("my-class")
let toggleForced_true: bool = tlist->toggleForced("my-class", true)
let toggleForced_false: bool = tlist->toggleForced("my-class", false)
let toString: string = tlist->toString
let value: string = tlist->value
let setValue: unit = tlist->setValue("foo")

0 comments on commit 495bdb3

Please sign in to comment.