Skip to content

Commit

Permalink
Merge pull request #33 from rachelnicole/plugin-tests
Browse files Browse the repository at this point in the history
Added additional plugin types
  • Loading branch information
scottnath authored Jun 16, 2016
2 parents 726489e + 1428eb7 commit fb5950e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/fixtures/input-plugins/input-plugin-single.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const validation = require('./lib/validation.js');

module.exports = {
name: 'Email',
description: 'Make sure email is good to go',
validation: {
emailValidation: validation,
},
inputs: {
email: {
validation: {
function: 'emailValidation',
on: 'blur',
},
label: 'Email',
placeholder: 'Email',
type: 'text',
settings: {
empty: false,
},
},
},
html: '<label for="{{email.id}}">{{email.label}}<input type="{{email.type}}" id="{{email.id}}" name="{{email.name}}" value="{{email.value}}" placeholder="{{email.placeholder}}" /></label>',
};
26 changes: 26 additions & 0 deletions tests/fixtures/input-plugins/lib/input-plugin-single-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const validation = require('./lib/validation.js');

module.exports = {
name: 'Kitten Name Selector',
description: 'Select a kitten name',
validation: {
kittenNameSelectorValidation: validation,
},
inputs: {
kittenNameSelector: {
validation: {
function: 'kittenNameSelectorValidation',
on: 'blur',
},
label: 'Choose a kitten name',
type: 'select',
settings: {
empty: false,
names: ['Michaelangelo', 'Leonardo', 'Raphael', 'Donatello', 'Muffins', 'Jeff']
},
},
},
html: `<label for="{{kittenNameSelector.id}}">{{kittenNameSelector.label}}<select id="{{kittenNameSelector.id}}" name="{{kittenNameSelector.name}}" value="{{kittenNameSelector.value}}">
{% for name in kittenNameSelector.settings.name %}<option value="{{name}}" {% if name == kittenNameSelector.value %}selected{% endif %}>{{name}}</option>{% endfor %}
</select></label>`,
};
23 changes: 23 additions & 0 deletions tests/fixtures/input-plugins/lib/input-plugin-single-textarea.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const validation = require('./lib/validation.js');

module.exports = {
name: 'Code Snippet',
description: 'Add code snippet for your cool doohickey',
validation: {
codeSnippetValidation: validation,
},
inputs: {
codeSnippet: {
validation: {
function: 'codeSnippetValidation',
on: 'blur',
},
label: 'Code Snippet',
type: 'textarea',
settings: {
empty: false,
},
},
},
html: '<label for="{{codeSnippet.id}}">{{codeSnippet.label}}<textarea type="{{codeSnippet.type}}" id="{{codeSnippet.id}}" name="{{codeSnippet.name}}">{{codeSnippet.value}}</textarea></label>',
};

0 comments on commit fb5950e

Please sign in to comment.