Fix style

This commit is contained in:
Adam Wathan 2019-10-11 14:29:38 -04:00
parent 4c25ca5ed6
commit 33e5546e9b
5 changed files with 40 additions and 37 deletions

View File

@ -7,7 +7,7 @@ test('plugins can add new theme values', () => {
corePlugins: [],
plugins: [
{
modifyConfig: function(config) {
modifyConfig(config) {
return {
...config,
theme: {
@ -17,26 +17,26 @@ test('plugins can add new theme values', () => {
'90': '90deg',
'180': '180deg',
'270': '270deg',
}
}
},
},
}
},
handler: function({ addUtilities, theme }) {
addUtilities(Object.entries(theme('rotate')).map(([key, value]) => {
return {
[`.rotate-${key}`]: {
transform: `rotate(${value})`,
},
}
}))
handler({ addUtilities, theme }) {
addUtilities(
Object.entries(theme('rotate')).map(([key, value]) => {
return {
[`.rotate-${key}`]: {
transform: `rotate(${value})`,
},
}
})
)
},
}
]
},
],
}),
])
.process('@tailwind utilities;',
{ from: undefined }
)
.process('@tailwind utilities;', { from: undefined })
.then(result => {
const expected = `
.rotate-0 {

View File

@ -1211,7 +1211,7 @@ test('plugins can be provided as an object with a handler function', () => {
const { components, utilities } = processPlugins(
[
{
handler: function({ addUtilities }) {
handler({ addUtilities }) {
addUtilities({
'.object-fill': {
'object-fit': 'fill',
@ -1224,7 +1224,7 @@ test('plugins can be provided as an object with a handler function', () => {
},
})
},
}
},
],
makeConfig()
)

View File

@ -1363,15 +1363,15 @@ test('plugin config modifications are applied', () => {
const userConfig = {
plugins: [
{
modifyConfig: function (config) {
modifyConfig(config) {
return {
...config,
prefix: 'tw-'
prefix: 'tw-',
}
},
handler: function () {}
}
]
handler() {},
},
],
}
const defaultConfig = {
@ -1391,7 +1391,7 @@ test('plugin config modifications are applied', () => {
}
const result = resolveConfig([userConfig, defaultConfig])
expect(result).toEqual({
prefix: 'tw-',
important: false,
@ -1415,15 +1415,15 @@ test('user config takes precedence over plugin config modifications', () => {
prefix: 'user-',
plugins: [
{
modifyConfig: function (config) {
modifyConfig(config) {
return {
...config,
prefix: 'plugin-'
prefix: 'plugin-',
}
},
handler: function () {}
}
]
handler() {},
},
],
}
const defaultConfig = {
@ -1443,7 +1443,7 @@ test('user config takes precedence over plugin config modifications', () => {
}
const result = resolveConfig([userConfig, defaultConfig])
expect(result).toEqual({
prefix: 'user-',
important: false,

View File

@ -1,7 +1,7 @@
module.exports = {
theme: {
screens: {
mobile: '400px',
},
},
}
theme: {
screens: {
mobile: '400px',
},
},
}

View File

@ -103,7 +103,10 @@ function resolveFunctionKeys(object) {
}
export default function resolveConfig([userConfig, defaultConfig]) {
const modifiedDefaultConfig = applyPluginConfigModifications(defaultConfig, get(userConfig, 'plugins', []))
const modifiedDefaultConfig = applyPluginConfigModifications(
defaultConfig,
get(userConfig, 'plugins', [])
)
const configs = [userConfig, modifiedDefaultConfig]
return defaults(