Fixed account settings tabpanels.
ECOM-4186
This commit is contained in:
@@ -73,18 +73,14 @@ define(['backbone',
|
||||
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
var request = requests[0];
|
||||
expect(request.method).toBe('GET');
|
||||
expect(request.url).toBe(Helpers.USER_ACCOUNTS_API_URL);
|
||||
|
||||
AjaxHelpers.respondWithError(requests, 500);
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
});
|
||||
|
||||
|
||||
@@ -93,18 +89,14 @@ define(['backbone',
|
||||
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
var request = requests[0];
|
||||
expect(request.method).toBe('GET');
|
||||
expect(request.url).toBe(Helpers.USER_ACCOUNTS_API_URL);
|
||||
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.createAccountSettingsData());
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
request = requests[1];
|
||||
expect(request.method).toBe('GET');
|
||||
@@ -116,9 +108,7 @@ define(['backbone',
|
||||
expect(request.url).toBe(Helpers.USER_PREFERENCES_API_URL);
|
||||
|
||||
AjaxHelpers.respondWithError(requests, 500);
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
});
|
||||
|
||||
it('renders fields after the models are successfully fetched', function() {
|
||||
@@ -126,15 +116,14 @@ define(['backbone',
|
||||
|
||||
var accountSettingsView = createAccountSettingsPage();
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.createAccountSettingsData());
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.TIME_ZONE_RESPONSE);
|
||||
AjaxHelpers.respondWithJson(requests, Helpers.createUserPreferencesData());
|
||||
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, false);
|
||||
accountSettingsView.render();
|
||||
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsAndFieldsToBeRendered(accountSettingsView);
|
||||
});
|
||||
|
||||
@@ -71,26 +71,16 @@ define(['backbone',
|
||||
var accountSettingsView = createAccountSettingsView();
|
||||
|
||||
accountSettingsView.render();
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
accountSettingsView.showLoadingError();
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
});
|
||||
|
||||
it('renders all fields as expected', function() {
|
||||
var accountSettingsView = createAccountSettingsView();
|
||||
|
||||
accountSettingsView.render();
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, true);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsButNotFieldsToBeRendered(accountSettingsView);
|
||||
|
||||
accountSettingsView.renderFields();
|
||||
Helpers.expectLoadingIndicatorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectLoadingErrorIsVisible(accountSettingsView, false);
|
||||
Helpers.expectSettingsSectionsAndFieldsToBeRendered(accountSettingsView);
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ define(['underscore'], function(_) {
|
||||
var expectSettingsSectionsAndFieldsToBeRendered = function(accountSettingsView, fieldsAreRendered) {
|
||||
var sectionsData = accountSettingsView.options.tabSections.aboutTabSections;
|
||||
|
||||
var sectionElements = accountSettingsView.$('.section');
|
||||
var sectionElements = accountSettingsView.$('#aboutTabSections-tabpanel .section');
|
||||
expect(sectionElements.length).toBe(sectionsData.length);
|
||||
|
||||
_.each(sectionElements, function(sectionElement, sectionIndex) {
|
||||
|
||||
Reference in New Issue
Block a user