mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-28 04:46:57 -04:00
#124/get items by group (#147)
* Add getItemsByGroup function * Update test * update readme * Update README for submit button * Update docs with ID prop for button and submit components
This commit is contained in:
@@ -15,6 +15,7 @@ describe('ClayConfig', function() {
|
||||
'getItemByMessageKey',
|
||||
'getItemById',
|
||||
'getItemsByType',
|
||||
'getItemsByGroup',
|
||||
'serialize',
|
||||
'registerComponent',
|
||||
'build',
|
||||
@@ -224,6 +225,7 @@ describe('ClayConfig', function() {
|
||||
'getItemByMessageKey',
|
||||
'getItemById',
|
||||
'getItemsByType',
|
||||
'getItemsByGroup',
|
||||
'serialize'
|
||||
].forEach(function(method) {
|
||||
it('.' + method + '()', function() {
|
||||
@@ -287,6 +289,25 @@ describe('ClayConfig', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('.getItemsByGroup()', function() {
|
||||
it('it returns the correct items', function() {
|
||||
var config = fixtures.config([
|
||||
{type: 'input', id: 'g1-0', group: 'group1'},
|
||||
{type: 'text', id: 'g2-0', group: 'group2'},
|
||||
{type: 'input', id: 'g1-1', group: 'group1'}
|
||||
]);
|
||||
|
||||
var clayConfig = fixtures.clayConfig(config);
|
||||
assert.deepEqual(clayConfig.getItemsByGroup('group1'), [
|
||||
clayConfig.getItemById('g1-0'),
|
||||
clayConfig.getItemById('g1-1')
|
||||
]);
|
||||
assert.deepEqual(clayConfig.getItemsByGroup('group2'), [
|
||||
clayConfig.getItemById('g2-0')
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.serialize()', function() {
|
||||
it('returns the correct settings', function() {
|
||||
var config = [
|
||||
|
||||
Reference in New Issue
Block a user