factor/basis/ui/gadgets/editors/editors-tests.factor

58 lines
1.8 KiB
Factor
Raw Normal View History

USING: accessors ui.gadgets.editors tools.test kernel io
io.streams.plain definitions namespaces ui.gadgets
ui.gadgets.grids prettyprint documents ui.gestures tools.test.ui
models documents.elements ;
2008-09-02 02:52:22 -04:00
IN: ui.gadgets.editors.tests
2007-09-20 18:09:08 -04:00
[ "foo bar" ] [
<editor> "editor" set
"editor" get [
"foo bar" "editor" get set-editor-string
"editor" get one-line-elt select-elt
"editor" get gadget-selection
] with-grafted-gadget
2007-09-20 18:09:08 -04:00
] unit-test
[ "baz quux" ] [
<editor> "editor" set
"editor" get [
"foo bar\nbaz quux" "editor" get set-editor-string
"editor" get one-line-elt select-elt
"editor" get gadget-selection
] with-grafted-gadget
2007-09-20 18:09:08 -04:00
] unit-test
[ ] [
<editor> "editor" set
"editor" get [
"foo bar\nbaz quux" "editor" get set-editor-string
4 hand-click# set
"editor" get position-caret
] with-grafted-gadget
] unit-test
2007-11-16 01:19:13 -05:00
2007-12-13 16:34:36 -05:00
[ "bar" ] [
<editor> "editor" set
"editor" get [
"bar\nbaz quux" "editor" get set-editor-string
2008-09-02 02:52:22 -04:00
{ 0 3 } "editor" get caret>> set-model
2007-12-13 16:34:36 -05:00
"editor" get select-word
"editor" get gadget-selection
] with-grafted-gadget
] unit-test
\ <editor> must-infer
2007-11-21 03:20:32 -05:00
2008-12-11 17:47:38 -05:00
"hello" <model> <model-field> "field" set
2007-11-21 03:20:32 -05:00
"field" get [
2008-09-02 02:52:22 -04:00
[ "hello" ] [ "field" get field-model>> value>> ] unit-test
2007-11-21 03:20:32 -05:00
] with-grafted-gadget
2009-01-25 23:56:35 -05:00
[ "Hello world." ] [ "Hello \n world." join-lines ] unit-test
[ " Hello world. " ] [ " Hello \n world. " join-lines ] unit-test
[ " Hello world. Goodbye." ] [ " Hello \n world. \n Goodbye." join-lines ] unit-test
[ ] [ <editor> com-join-lines ] unit-test
[ ] [ <editor> "A" over set-editor-string com-join-lines ] unit-test
[ "A B" ] [ <editor> "A\nB" over set-editor-string [ com-join-lines ] [ editor-string ] bi ] unit-test