add blankTitle option
This commit is contained in:
@@ -421,7 +421,7 @@ class AccountSettingsPageTest(AccountSettingsTestMixin, AcceptanceTest):
|
||||
self._test_dropdown_field(
|
||||
u'time_zone',
|
||||
u'Time Zone',
|
||||
u'',
|
||||
u'Default (Local Time Zone)',
|
||||
[
|
||||
u'Europe/Kiev ({abbr}, UTC{offset})'.format(abbr=kiev_abbr, offset=kiev_offset),
|
||||
u'US/Pacific ({abbr}, UTC{offset})'.format(abbr=pacific_abbr, offset=pacific_offset),
|
||||
|
||||
@@ -54,7 +54,8 @@ define(['backbone',
|
||||
valueAttribute: 'time_zone',
|
||||
groupOptions: [{
|
||||
groupTitle: gettext('All Time Zones'),
|
||||
selectOptions: FieldViewsSpecHelpers.SELECT_OPTIONS
|
||||
selectOptions: FieldViewsSpecHelpers.SELECT_OPTIONS,
|
||||
blankTitle: 'Default (Local Time Zone)'
|
||||
}],
|
||||
persistChanges: true,
|
||||
required: true
|
||||
@@ -97,7 +98,7 @@ define(['backbone',
|
||||
|
||||
// expect time zone dropdown to have two subheaders (country/all time zone sub-headers) with new values
|
||||
expect(timeZoneView.$(groupsSelector).length).toBe(2);
|
||||
expect(timeZoneView.$(groupOptionsSelector).length).toBe(5);
|
||||
expect(timeZoneView.$(groupOptionsSelector).length).toBe(6);
|
||||
expect(timeZoneView.$(groupOptionsSelector)[0].value).toBe('America/Guyana');
|
||||
|
||||
// select time zone option from option
|
||||
|
||||
@@ -118,7 +118,8 @@
|
||||
helpMessage: gettext('Select the time zone for displaying course dates. If you do not specify a time zone, course dates, including assignment deadlines, will be displayed in your browser\'s local time zone.'), // eslint-disable-line max-len
|
||||
groupOptions: [{
|
||||
groupTitle: gettext('All Time Zones'),
|
||||
selectOptions: fieldsData.time_zone.options
|
||||
selectOptions: fieldsData.time_zone.options,
|
||||
blankTitle: gettext('Default (Local Time Zone)')
|
||||
}],
|
||||
persistChanges: true
|
||||
})
|
||||
|
||||
@@ -20,16 +20,20 @@
|
||||
<span class="u-field-value-readonly"></span>
|
||||
<% } else { %>
|
||||
<select name="select" id="u-field-select-<%- id %>" aria-describedby="u-field-help-message-<%- id %>">
|
||||
<% if (showBlankOption) { %>
|
||||
<option value=""></option>
|
||||
<% } %>
|
||||
<% _.each(groupOptions, function(groupOption) { %>
|
||||
<% if (groupOption.groupTitle != null) { %>
|
||||
<optgroup label="<%- groupOption.groupTitle %>">
|
||||
<% if (showBlankOption) { %>
|
||||
<% if (groupOption.blankTitle) { %>
|
||||
<option value=""><%- groupOption.blankTitle %></option>
|
||||
<% } else { %>
|
||||
<option value=""></option>
|
||||
<% } %>
|
||||
<% } %>
|
||||
<% _.each(groupOption.selectOptions, function(selectOption) { %>
|
||||
<option value="<%- selectOption[0] %>"><%- selectOption[1] %></option>
|
||||
<% }); %>
|
||||
<% if (groupOption.groupTitle != null) { %>
|
||||
<optgroup label="<%- groupOption.groupTitle %>">
|
||||
<% } %>
|
||||
<% _.each(groupOption.selectOptions, function(selectOption) { %>
|
||||
<option value="<%- selectOption[0] %>"><%- selectOption[1] %></option>
|
||||
<% }); %>
|
||||
<% }); %>
|
||||
</select>
|
||||
<span class="icon-caret-down" aria-hidden="true"></span>
|
||||
|
||||
Reference in New Issue
Block a user