Implement renderInstructions for themer-slack
This commit is contained in:
parent
321ebbc50c
commit
f20a812c8e
@ -12,6 +12,4 @@ Then pass `themer-slack` as a `-t` (`--template`) arg to `themer`:
|
||||
|
||||
themer -c my-colors.js -t themer-slack -o gen
|
||||
|
||||
## Output
|
||||
|
||||
`themer-slack` will generate a `themer-slack-dark.txt` or `themer-slack-light.txt` file (or both), depending on the color set you passed to themer. Simply copy the contents of this file and paste into the custom theme input in Slack's preferences.
|
||||
Installation instructions for the generated theme(s) will be included in `<output dir>/README.md`.
|
||||
|
@ -0,0 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renderInstructions should provide installation instructions 1`] = `
|
||||
"
|
||||
Copy the contents of \`themer-slack-dark.txt\` or \`themer-slack-light.txt\` and paste into the custom theme input in Slack's preferences.
|
||||
"
|
||||
`;
|
@ -14,6 +14,11 @@ const render = colors => Object.entries(colors).map(
|
||||
})
|
||||
);
|
||||
|
||||
const renderInstructions = paths => `
|
||||
Copy the contents of ${paths.map(p => `\`${p}\``).join(' or ')} and paste into the custom theme input in Slack's preferences.
|
||||
`;
|
||||
|
||||
module.exports = {
|
||||
render,
|
||||
renderInstructions,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { render } = require('./index'),
|
||||
const { render, renderInstructions } = require('./index'),
|
||||
{ colors } = require('../../themer-colors-default');
|
||||
|
||||
describe('render', () => {
|
||||
@ -20,3 +20,11 @@ describe('render', () => {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('renderInstructions', () => {
|
||||
it('should provide installation instructions', async () => {
|
||||
const files = await Promise.all(render(colors));
|
||||
const instructions = renderInstructions(files.map(({ name }) => name));
|
||||
expect(instructions).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user