livebook/assets/test/lib/text_utils.test.js
Jonatan Kłosko e2490c0f7f
Implement signature intellisense (#640)
* Remove Code.Fragment backport

* Fix tests compatibility with Elixir 1.13

* Implement signature intellisense

* Don't show signatures on module attributes

* Add tests for calls with do-end block

* Unify spec formatting

* Insert parentheses when completing a function call

* Send all text until cursor in signature request

* Add configuration for completion/signature popups (#693)

* Add editor settings form

* Add configuration for intellisense defaults

* Read fresh settings when editor mounts

* Scope attribute names

* Fix disabled button styling

* Simplify signature box and enable by default

* Split settings into system and user sections

* Update lib/livebook_web/live/settings_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/settings_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Fix spacing in documentation tests

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-12-03 21:57:21 +01:00

10 lines
484 B
JavaScript

import { replacedSuffixLength } from "../../js/lib/text_utils";
test("replacedSuffixLength", () => {
expect(replacedSuffixLength("to_string(", "")).toEqual(0);
expect(replacedSuffixLength("to_string(", "length")).toEqual(0);
expect(replacedSuffixLength("length", "length")).toEqual(6);
expect(replacedSuffixLength("x = ~", "~r")).toEqual(1);
expect(replacedSuffixLength("Enum.ma", "map")).toEqual(2);
expect(replacedSuffixLength("Enum.ma", "map_reduce")).toEqual(2);
});