Skip to content

Commit 495bdb3

Browse files
authored
Merge pull request #136 from jcuenod/fix/toggle-forced
2 parents 7f2cf0a + 67961b4 commit 495bdb3

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
1212
## main
1313

14-
1514
#### :boom: Breaking Change
1615

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

1919
#### :bug: Bug Fix
2020

lib/js/tests/Webapi/Dom/Webapi__Dom__DomTokenList__test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ var supports = tlist.supports("my-class");
2828

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

31-
var toggleForced = tlist.toggle("my-class", true);
31+
var toggleForced_true = tlist.toggle("my-class", true);
32+
33+
var toggleForced_false = tlist.toggle("my-class", false);
3234

3335
var toString = tlist.toString();
3436

@@ -46,7 +48,8 @@ exports.item = item$1;
4648
exports.contains = contains;
4749
exports.supports = supports;
4850
exports.toggle = toggle;
49-
exports.toggleForced = toggleForced;
51+
exports.toggleForced_true = toggleForced_true;
52+
exports.toggleForced_false = toggleForced_false;
5053
exports.toString = toString;
5154
exports.value = value;
5255
exports.setValue = setValue;

src/Webapi/Dom/Webapi__Dom__DomTokenList.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type t = Dom.domTokenList
1414
@send external replace: (t, string, string) => unit = "replace" /* experimental */
1515
@send external supports: (t, string) => bool = "supports" /* experimental, Content Management Level 1 */
1616
@send external toggle: (t, string) => bool = "toggle"
17-
@send external toggleForced: (t, string, @as(json`true`) _) => bool = "toggle"
17+
@send external toggleForced: (t, string, bool) => bool = "toggle"
1818
@send external toString: t => string = "toString"
1919
/* values: iterator API, should have language support */
2020

tests/Webapi/Dom/Webapi__Dom__DomTokenList__test.res

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ tlist->removeMany(["my-class", "my-other-class"])
1515
tlist->replace("my-class", "my-other-class")
1616
let supports: bool = tlist->supports("my-class")
1717
let toggle: bool = tlist->toggle("my-class")
18-
let toggleForced: bool = tlist->toggleForced("my-class")
18+
let toggleForced_true: bool = tlist->toggleForced("my-class", true)
19+
let toggleForced_false: bool = tlist->toggleForced("my-class", false)
1920
let toString: string = tlist->toString
2021
let value: string = tlist->value
2122
let setValue: unit = tlist->setValue("foo")

0 commit comments

Comments
 (0)