Commit 9ac08ac5 by muzaffaryousaf Committed by Andy Armstrong

Moving the country field to the required section of account setting page.

TNL-1856
parent bc05cd0c
...@@ -101,6 +101,7 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest): ...@@ -101,6 +101,7 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest):
'Email Address', 'Email Address',
'Password', 'Password',
'Language', 'Language',
'Country or Region'
] ]
}, },
{ {
...@@ -109,7 +110,6 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest): ...@@ -109,7 +110,6 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest):
'Education Completed', 'Education Completed',
'Gender', 'Gender',
'Year of Birth', 'Year of Birth',
'Country or Region',
'Preferred Language', 'Preferred Language',
] ]
}, },
...@@ -286,8 +286,8 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest): ...@@ -286,8 +286,8 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, WebAppTest):
self._test_dropdown_field( self._test_dropdown_field(
u'country', u'country',
u'Country or Region', u'Country or Region',
u'', u'Afghanistan',
[u'Pakistan', u''], [u'Pakistan', u'Palau'],
) )
def test_preferred_language_field(self): def test_preferred_language_field(self):
......
...@@ -148,7 +148,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j ...@@ -148,7 +148,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
var sectionsData = accountSettingsView.options.sectionsData; var sectionsData = accountSettingsView.options.sectionsData;
expect(sectionsData[0].fields.length).toBe(5); expect(sectionsData[0].fields.length).toBe(6);
var textFields = [sectionsData[0].fields[1], sectionsData[0].fields[2]]; var textFields = [sectionsData[0].fields[1], sectionsData[0].fields[2]];
for (var i = 0; i < textFields.length ; i++) { for (var i = 0; i < textFields.length ; i++) {
...@@ -165,10 +165,14 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j ...@@ -165,10 +165,14 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
}, requests); }, requests);
} }
expect(sectionsData[1].fields.length).toBe(5); expect(sectionsData[1].fields.length).toBe(4);
for (var i = 0; i < 4; i++) { var dropdownFields = [
sectionsData[1].fields[0],
var view = sectionsData[1].fields[i].view; sectionsData[1].fields[1],
sectionsData[1].fields[2]
];
_.each(dropdownFields, function(field) {
var view = field.view;
FieldViewsSpecHelpers.verifyDropDownField(view, { FieldViewsSpecHelpers.verifyDropDownField(view, {
title: view.options.title, title: view.options.title,
valueAttribute: view.options.valueAttribute, valueAttribute: view.options.valueAttribute,
...@@ -178,7 +182,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j ...@@ -178,7 +182,7 @@ define(['backbone', 'jquery', 'underscore', 'js/common_helpers/ajax_helpers', 'j
invalidValue2: Helpers.FIELD_OPTIONS[3][0], invalidValue2: Helpers.FIELD_OPTIONS[3][0],
validationError: "Nope, this will not do!" validationError: "Nope, this will not do!"
}, requests); }, requests);
} });
var section2Fields = sectionsData[2].fields; var section2Fields = sectionsData[2].fields;
expect(section2Fields.length).toBe(2); expect(section2Fields.length).toBe(2);
......
...@@ -81,6 +81,15 @@ ...@@ -81,6 +81,15 @@
), ),
options: fieldsData.language.options options: fieldsData.language.options
}) })
},
{
view: new FieldViews.DropdownFieldView({
model: userAccountModel,
required: true,
title: gettext('Country or Region'),
valueAttribute: 'country',
options: fieldsData['country']['options']
})
} }
] ]
}, },
...@@ -108,15 +117,7 @@ ...@@ -108,15 +117,7 @@
model: userAccountModel, model: userAccountModel,
title: gettext('Year of Birth'), title: gettext('Year of Birth'),
valueAttribute: 'year_of_birth', valueAttribute: 'year_of_birth',
options: fieldsData.year_of_birth.options options: fieldsData['year_of_birth']['options']
})
},
{
view: new FieldViews.DropdownFieldView({
model: userAccountModel,
title: gettext('Country or Region'),
valueAttribute: 'country',
options: fieldsData.country.options
}) })
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment