Skip to content

Commit

Permalink
😒 fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Jun 28, 2016
2 parents 9dd2ef4 + d6e0a3e commit c74e15a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/content-types/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ const squish = (types) => {
merged.script = plugin.inputs[attr].script;
}

// Options of attribute overrides default
if (attribute.inputs[attr].hasOwnProperty('options')) {
merged.options = attribute.inputs[attr].options;
}

// add required if it doesn't exist
if (!merged.hasOwnProperty('required')) {
merged.required = plugin.required;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"eslint-config-punchcard": "^1.0.0",
"ghooks": "^1.2.4",
"input-plugin-datetime": "^0.0.1",
"input-plugin-select": "^0.1.0",
"input-plugin-email": "^0.1.0",
"input-plugin-quote": "0.0.1",
"input-plugin-selects-related": "0.0.1",
Expand Down
14 changes: 13 additions & 1 deletion tests/fixtures/content-types/baz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,16 @@ attributes:
name: Two related select elements
id: input-related-selects
description: I am a set of selects

- type: select
name: example dropdown
id: example-dropdown
inputs:
select:
label: Example Dropdown
options:
- label: Option 1
value: option1
- label: Option 2
value: option2
settings:
multiple: false
13 changes: 13 additions & 0 deletions tests/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,16 @@ test('Form Generation, with ux scripts', t => {
t.true(includes(rendered.validation, 'function selectsRelatedScript(', 'includes ux scripts'));
});
});

test('Form Generation, overrides options in select', t => {
return types.only('baz').then(result => {
return form(result);
}).then(rendered => {
t.true(includes(rendered.html, '<option value="option1" >Option 1</option>', 'determines existence of option1'));
t.true(includes(rendered.html, '<option value="option2" >Option 2</option>', 'determines existence of option2'));
t.false(includes(rendered.html, '<option value="mike" >Michaelangelo</option>', 'determines non-existence of default option 1'));
t.false(includes(rendered.html, '<option value="leo" >Leonardo</option>', 'determines non-existence of default option 2'));
t.false(includes(rendered.html, '<option value="ralph" >Raphael</option>', 'determines non-existence of default option 3'));
t.false(includes(rendered.html, '<option value="don" >Donatello</option>', 'determines non-existence of default option 4'));
});
});
1 change: 0 additions & 1 deletion tests/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ test('Validate - Pass', t => {
};

const result = validation(input, ct);

t.true(result, 'All validation passes');
});
});
Expand Down

0 comments on commit c74e15a

Please sign in to comment.