diff --git a/test/blackbox-tests/dom-props-completion.t b/test/blackbox-tests/dom-props-completion.t index 6672892c7..1fd85c1b9 100644 --- a/test/blackbox-tests/dom-props-completion.t +++ b/test/blackbox-tests/dom-props-completion.t @@ -26,9 +26,9 @@ Build a valid component to initialize the Merlin configuration. Query completion before the closing tag, checking representative ordinary props. $ complete () { - > ocamlmerlin single complete-prefix -position 3:2 -prefix "" \ + > ocamlmerlin single complete-prefix -position "${1:-3:2}" -prefix "${2:-}" \ > -filename component.re < component.re | - > jq -c '[.value.context[1].labels[].name | select(. == "?id" or . == "?onClick" or . == "?style")] | sort' + > jq -c '[.value.context[1].labels[].name | select(. == "?id" or . == "?onClick" or . == "?style" or . == "?className" or startswith("~"))] | sort' > } $ complete ["?id","?onClick","?style"] @@ -54,3 +54,55 @@ The same holds for an optional data attribute. > EOF $ complete ["?id","?onClick","?style"] + +Partially typed names still complete ordinary props. Already supplied props and +generated helper arguments must not appear in the suggestions. + + $ cat > component.re < let element = + >
onC />; + > EOF + $ complete 3:5 onC + ["?id","?onClick","?style"] + + $ cat > component.re < let element = + >
onC />; + > EOF + $ complete 3:5 onC + ["?id","?onClick","?style"] + +Completion also works between data attributes, before any ordinary prop is set. + + $ cat > component.re < let element = + >
cla dataBar="last" />; + > EOF + $ complete 3:5 cla + ["?className","?id","?onClick","?style"] + +Nested JSX keeps its own completion context, including inside ordinary prop +expressions. + + $ cat > component.re < let element = + >
+ >
; + > EOF + $ complete 4:9 onC + ["?id","?onClick","?style"] + + $ cat > component.re < let element = + >