In the context of UI Unit tests, if I start editing an item in the grid with editor.editItem(item) and then try to check whether editor.isOpen(), it returns false.
I assume this is because item is marked for editing after call to “frontend” in EditorImpl.editItem(T item) method:
isOpen checks the item you passed editItem to see if it is null. Are you sure your item is not null? (Answering for myself:) I guess it would have to be non-null or you would have gotten an error calling editItem… Hmmm…
I see. (I’m a little slow.) The editItem method runs some JS to edit the item, and it is a callback (editItemRequest) from that JS that sets the item being edited. Since the JS isn’t run in unit tests, that callback is not run and therefore the item is never set.
I suppose it should be possible to extend GridTester to give it an editItem method that you would call instead of the one in the Grid and then check it through your extended GridTester’s internal state.
It sounds to me like an enhancement ticket is in order. I don’t see one for this. Could you open one?
Anyway, you should avoid calling view methods directly from the test.
You should simulate actions you do in the browser. for example, if the editor gets opened by double-clicking a grid row, you should just use the GridTesters to send the double click on that row.