dfreeman / ember-ace

An Ember component for the Ace code editor
MIT License
29 stars 19 forks source link

In an acceptance test, setting the value doesn't wipe the previous value #20

Open BillyRayPreachersSon opened 6 years ago

BillyRayPreachersSon commented 6 years ago

We're using the following versions in package.json:

"ember-cli": "~2.16.2"
"ember-ace": "1.2.0"
"ember-cli-page-object": "1.8.0"
"ember-cli-qunit": "^4.0.0"

We've got a page object that defines a selector to the editor:

myEditor: {
  scope: '.container-class .ace_text-input'
}

And an acceptance test that fills in some text and saves the form:

page.visit();
page.myEditor.fillIn('Some value');
page.save();

That all works, and the entered value gets sent back from the form as expected.

However, if I want to set the value to something else later in the test:

page.myEditor.fillIn('A new value');

then what actually gets sent to the server is a concatenation of both strings (which is also what is visible in the editor), so in the case of this example, it would be Some valueA new value.

Is there a way to clear the editor in an acceptance test rather then appending to its content?

Thanks!

dfreeman commented 6 years ago

The fillIn helper in ember-cli-page-object isn't a perfect imitation of all the events that real user interactions tend to produce. You could try using ember-native-dom-helpers to see if a more accurate facsimile does the trick.

This addon also ships with a page object implementation you could try using. Take a look at the component integration tests to see how it's used.

ro0gr commented 5 years ago

Hi, not sure if that's still applicable..

ember-cli-page-object currently supports both ember-native-dom-helpers and ember/test-helpers. The legacy Ember's moduleForComponent is the only mode where the page object does its own craft in order to imitate user interactions, like fillIn, etc..

villander commented 5 years ago

I want use test helpers without use ember-cli-page-object - https://github.com/dfreeman/ember-ace/issues/34