don't save null value if no value is provided
fixes PLAT-1762 test plan: * Add a manual external app * Enter valid settings but leave the description and domain blank * Save the app * Edit the same app and save again * Edit and ensure the domain and description are not "null" Change-Id: I7046ef564790acd8ae790c42611d832ae9f803e6 Reviewed-on: https://gerrit.instructure.com/88861 Reviewed-by: Pedro Fajardo <pfajardo@instructure.com> Tested-by: Jenkins QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com> Reviewed-by: Andrew Butterfield <abutterfield@instructure.com> Product-Review: August Thornton <august@instructure.com>
This commit is contained in:
parent
38a4420425
commit
13711dc255
|
@ -130,7 +130,7 @@ define([
|
|||
<TextInput
|
||||
ref="domain"
|
||||
id="domain"
|
||||
defaultValue={this.props.domain}
|
||||
defaultValue={this.props.domain ? this.props.domain : ''}
|
||||
label={I18n.t('Domain')}
|
||||
errors={this.state.errors} />
|
||||
</div>
|
||||
|
@ -157,7 +157,7 @@ define([
|
|||
<TextAreaInput
|
||||
ref="description"
|
||||
id="description"
|
||||
defaultValue={this.props.description}
|
||||
defaultValue={this.props.description ? this.props.description : ''}
|
||||
label={I18n.t('Description')}
|
||||
rows={6}
|
||||
errors={this.state.errors} />
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
define([
|
||||
'react',
|
||||
'jsx/external_apps/components/ConfigurationFormManual'
|
||||
], (React, ConfigurationFormManual) => {
|
||||
|
||||
const TestUtils = React.addons.TestUtils;
|
||||
|
||||
module('External Apps Manual Configuration Form');
|
||||
|
||||
const fakeStore = {
|
||||
findAppByShortName () {
|
||||
return {
|
||||
short_name: 'someApp',
|
||||
config_options: []
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const component = TestUtils.renderIntoDocument (
|
||||
<ConfigurationFormManual
|
||||
domain=''
|
||||
description=''
|
||||
shortName="someApp"
|
||||
store={fakeStore}
|
||||
/>
|
||||
);
|
||||
|
||||
test('domain field should not be null', () => {
|
||||
|
||||
const app = TestUtils.findRenderedComponentWithType(component, ConfigurationFormManual);
|
||||
|
||||
equal(app.props.domain, '');
|
||||
});
|
||||
|
||||
test('description field should not be null', () => {
|
||||
|
||||
const app = TestUtils.findRenderedComponentWithType(component, ConfigurationFormManual);
|
||||
|
||||
equal(app.props.description, '');
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue