Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export test helpers for downstream consumers #100

Closed
bantic opened this issue Aug 3, 2016 · 4 comments · Fixed by #107
Closed

export test helpers for downstream consumers #100

bantic opened this issue Aug 3, 2016 · 4 comments · Fixed by #107

Comments

@bantic
Copy link
Contributor

bantic commented Aug 3, 2016

For apps that depend on ember-mobiledoc-editor, documenting and exporting test-helpers (like runLater and moveCursorTo) would make development easier.

@bantic
Copy link
Contributor Author

bantic commented Sep 1, 2016

High-level acceptance test level helpers would also be good (like insertText(editorElement, 'sometext'), or simply making it so that fillIn works with an editor element)

@chrisdpeters
Copy link
Contributor

@bantic Do you have any suggestions for workarounds for acceptance testing? I am finding that I need to just skip acceptance tests for anything non-trivial involving ember-mobiledoc-editor for now because I can't seem to be able to interact with the editor at all.

I'm not really trying to test specific editor functionality but would like to test overall acceptance scenarios like basic updates to the content, calling the update endpoint, and updating the overall UI with flash notifications, etc.

@bantic
Copy link
Contributor Author

bantic commented Sep 6, 2016

@chrisdpeters If you are testing basic scenarios of the form "no-content"->"any-content" and vice versa, modifying the dom in the editor directly should be ok to do, but you may run into some trouble due to the async nature of the code here. I will play around with this a bit and make a specific suggestion.

@bantic
Copy link
Contributor Author

bantic commented Sep 6, 2016

@chrisdpeters I think we can actually keep an internal reference to the editor instance in tests, and export a test helper that accesses it and can update the editor...I will make a spike on this tomorrow.

bantic added a commit that referenced this issue Sep 13, 2016
Usage:
```
// acceptance test
import { insertText, run } from '../../helpers/ember-mobiledoc-editor';

test('visit /', function(assert) {
  visit('/');
  andThen(() => {
    let editorEl = find('.mobiledoc-kit')[0];
    return insertText(editorEl, 'here is some text');
    /* Or:
      return run(editorEl, (postEditor) => ...);
    */
  });
  andThen(() => {
    // assert text inserted, etc.
  });
});

```

fixes #100
bantic added a commit that referenced this issue Sep 13, 2016
Usage:
```
// acceptance test
import { insertText, run } from '../../helpers/ember-mobiledoc-editor';

test('visit /', function(assert) {
  visit('/');
  andThen(() => {
    let editorEl = find('.mobiledoc-kit')[0];
    return insertText(editorEl, 'here is some text');
    /* Or:
      return run(editorEl, (postEditor) => ...);
    */
  });
  andThen(() => {
    // assert text inserted, etc.
  });
});

```

fixes #100
bantic added a commit that referenced this issue Sep 13, 2016
…itor helpers (#107)

Usage:
```
// acceptance test
import { insertText, run } from '../../helpers/ember-mobiledoc-editor';

test('visit /', function(assert) {
  visit('/');
  andThen(() => {
    let editorEl = find('.mobiledoc-kit')[0];
    return insertText(editorEl, 'here is some text');
    /* Or:
      return run(editorEl, (postEditor) => ...);
    */
  });
  andThen(() => {
    // assert text inserted, etc.
  });
});

```

fixes #100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants