-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
How should I handle a full scenario involving handleCreate and store.query? #143
Comments
What version of ed and factory guy are you using? |
I'm on ED 1.13.14 and EDFG 1.13.10. Does 2.1.0 play nicely with ED 1.13.14? |
it does .. give it a try ( might not fix issue right off ) .. but then I can work from there to find solution |
Cool! I'll give it a shot and report back. Thanks for the quick replies! |
OK, I'm seeing the same thing on 2.1.0. |
good .. in the test |
without stepping through this I can't quite tell though what is the issue. |
It's test('create a new category', function(assert) {
TestHelper.handleQuery('category', {}, []);
visit('/admin/categories');
andThen(function() {
assert.equal(find('.empty-block').length, 1);
assert.equal(find('table tbody tr').length, 0);
});
click('a:contains(New Category)');
andThen(function() {
assert.equal(currentPath(), 'admin.categories.new');
fillIn('div:contains(Name) input', 'MyString');
fillIn('div:contains(Description) input', 'MyString');
TestHelper.handleCreate('category');
click('button:submit');
});
andThen(function() {
assert.equal(currentPath(), 'admin.categories.index');
//TODO : Figure out why ember-data-factory-guy doesn't see the new model
// https://github.com/danielspaniel/ember-data-factory-guy/issues/143
assert.equal(find('.empty-block').length, 0);
assert.equal(find('table tbody tr').length, 1);
});
}); And then my category route is: export default Ember.Route.extend({
model: function() {
return this.store.query('category',{});
}
}); |
I would even be happier if you could make a test like your's that fails on the factory guy repo ( basically write that same test ) so I could fix it much easier |
To be clear if I use |
its odd because handleQuery mocks a GET request .. so this is highly interesting case of huh? |
…pted-ember-addons#143) This is just a quick and dirty import of the category acceptance test from my project. I pulled in everything that I needed to make the other parts of it pass, just to sanity check that things were working.
OK, here's a PR with a test that's failing the same way : #144 |
super .. thanks .. I will snoop around and let you know |
in that test:
it is failing even with TestHelper.handleFindAll('category', 0); |
never mind .. its the index route |
Argh! I was testing different things and accidentally committed the wrong one. I'll update the PR so that it's at least consistent with what I'm trying to isolate. |
looks like the answer might be here: Note: When creating a new record using any of the above methods Ember Data will update DS.RecordArrays such as those returned by store#peekAll(), store#findAll() or store#filter(). with store.query() .. its going to make new array every time ..
and to fix it you would have to be able to do this:
and since that ability is not available
you can't do anything. But luckily .. this very issue has a solution proposed by someone else . .and I am going to implement it asap .. like in the next 4 days. see issue #139 so you would do this:
|
This issue is now fixed in the newest release 2.1.1 I made a test just for you:
If you don't get it, let me know and I will explain |
I'm trying to test a full UI flow that starts with no categories, adds one, and then checks to make sure that it is displayed. I'm running into trouble when I try to use
store.query
in my route instead ofstore.findAll
.If my route uses
store.findAll
, then this acceptance test will work perfectly.But if I change my route to use
store.query
and change the first line of the test to beTestHelper.handleQuery('category', {}, []);
then the final twoassert.equal
tests fail, and when Ireturn pauseTest();
before them I can see that as far as Ember is concerned I still don't have any categories.Am I missing something?
The text was updated successfully, but these errors were encountered: