Test custom core plugin config overrides default core plugin config

This commit is contained in:
Adam Wathan 2019-02-05 11:00:43 -05:00
parent 4afb9e45e6
commit 4c2be2ac2c

View File

@ -122,3 +122,52 @@ test('plugins are configured with their default configuration if no custom confi
{ plugin: 'backgroundPosition', options: {} },
])
})
test('custom plugin configuration overrides default plugin configuration', () => {
const plugins = {
fontSize: options => {
return {
plugin: 'fontSize',
options,
}
},
display: options => {
return {
plugin: 'display',
options,
}
},
backgroundPosition: options => {
return {
plugin: 'backgroundPosition',
options,
}
},
}
const configuredPlugins = configurePlugins(plugins, {
fontSize: {
variants: ['responsive', 'hover'],
values: { '12': '12px', '14': '14px', '16': '16px' },
},
display: { variants: ['responsive'] },
backgroundPosition: {},
}, {
fontSize: {
variants: ['focus', 'active'],
values: { 'sm': '.75rem', 'md': '1rem', 'lg': '1.5rem' },
},
})
expect(configuredPlugins).toEqual([
{
plugin: 'fontSize',
options: {
variants: ['responsive', 'hover'],
values: { '12': '12px', '14': '14px', '16': '16px' },
},
},
{ plugin: 'display', options: { variants: ['responsive'] } },
{ plugin: 'backgroundPosition', options: {} },
])
})