-
15 May 2011 11:00 AM #1
Ex.Loader does not Load associations of a Model
Ex.Loader does not Load associations of a Model
I have a test setup using Jasmine to write my tests. I use Ext.Loader so I do not need to include all my class files into the test index page. However, using this setup I run into problems when I load models with associations. Normally, when an instance of a model is created, a method is created for each association. This does not happen when using Ext.Loader to load the required association models synchronously.
For example when I run the below sampel code for a very simple LoginModel with one hasMany association of ValidationRuleModel the following happens:
- The first 3 tests pass, the 'LoginModel should have a validationRules method' fails, however,
- The last test, checking the existence of the validationRules method passes, because now I created an instance of ValidationRuleModel first, forcing Ext.Loader to load the model.
I believe this is a bug in the Ext.Loader.
Code:describe('Ext.Loader', function () { var createLoginModel, createValidationRuleModel; createLoginModel = function () { return Ext.create('GenForm.model.user.LoginModel'); }; createValidationRuleModel = function () { return Ext.create('GenForm.model.validation.ValidationRuleModel'); }; it('should be enabled', function () { expect(Ext.Loader.config.enabled).toBe(true); }); it('should have a GenForm path', function () { expect(Ext.Loader.config.paths.GenForm).toBeDefined(); }); it('GenForm.model.user.LoginModel can be created', function () { expect(createLoginModel()).toBeDefined(); }); it('LoginModel should have validationRules method', function () { expect(createLoginModel().validationRules).toBeDefined(); }); it('LoginModel should have validationRules after creating ValidationRuleModel', function () { createValidationRuleModel(); expect(createLoginModel().validationRules).toBeDefined(); }); });
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Model Associations Through Objects
By butr0s in forum Ext: DiscussionReplies: 1Last Post: 4 May 2011, 5:48 PM -
Associations model many to many
By Fanny144 in forum Ext: DiscussionReplies: 0Last Post: 3 May 2011, 5:10 AM -
data.Model with self join associations.
By Ozone in forum Ext: DiscussionReplies: 0Last Post: 4 Apr 2011, 4:27 AM -
[CLOSED]cannot extend Model having associations (PR5)
By christophe.geiser in forum Ext:BugsReplies: 3Last Post: 31 Mar 2011, 12:05 AM


Reply With Quote