-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from rachelnicole/plugin-tests
Added additional plugin types
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
26
tests/fixtures/input-plugins/lib/input-plugin-single-select.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
23
tests/fixtures/input-plugins/lib/input-plugin-single-textarea.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>', | ||
}; |