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

Add insertText and run ember-mobiledoc-kit editor helpers #107

Merged
merged 1 commit into from
Sep 13, 2016

Conversation

bantic
Copy link
Contributor

@bantic bantic commented 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

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 bantic force-pushed the add-acceptance-test-helpers branch from 1497a56 to 1030898 Compare September 13, 2016 16:45
@bantic bantic merged commit 84f311e into master Sep 13, 2016
@bantic bantic deleted the add-acceptance-test-helpers branch September 13, 2016 17:58
@bantic
Copy link
Contributor Author

bantic commented Sep 13, 2016

@chrisdpeters These are released in v0.5.6. Does that work for your needs in #100?

@chrisdpeters
Copy link
Contributor

@bantic I switched to a bunch of API work in October, which lasted quite some time, so I was unable to try any of this out until now. I'm now messaging you 3 months into the future to say, "Thank you!"

The only problem that I've experienced so far has been with your example.

let editorEl = find('.mobiledoc-kit')[0];

With that, editorEl ends up being null.

I seem to have better luck if I use this selector: .mobiledoc-editor__editor. It looks like this class is also set on the editor element: .__mobiledoc-editor.

If you think this is indeed the correct behavior, then I could submit a small pull request with an updated README.

I'll let you know if I run across any other issues, but this seems to be working pretty well so far.

@bantic
Copy link
Contributor Author

bantic commented Jan 9, 2017

@chrisdpeters Thanks for the comment to let me know this is working for you! Glad that is working.
Yes, I think you are correct about using the other selector. If you are able to submit a PR for this I'd be happy to merge it. thanks!

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 this pull request may close these issues.

export test helpers for downstream consumers
2 participants