Skip to content

Instantly share code, notes, and snippets.

@odoe
Last active September 3, 2019 22:37
Show Gist options
  • Save odoe/59e249ebf01eac2adf87d437b16b9ccd to your computer and use it in GitHub Desktop.
Save odoe/59e249ebf01eac2adf87d437b16b9ccd to your computer and use it in GitHub Desktop.
snippet dtsx "Dojo tsx widget"
import { create, tsx } from '@dojo/framework/core/vdom';
const factory = create();
export default factory(function $1() {
return (
<div>Widget</div>
);
});
endsnippet
snippet mw "Dojo Middleware"
import { $1 } from '@dojo/framework/core/middleware/$1';
endsnippet
snippet dcf "Dojo Command Factory"
import { createProcess, createCommandFactory } from '@dojo/framework/stores/process';
import { State } from '$1';
const commandFactory = createCommandFactory<State>();
endsnippet
snippet dp "Dojo Process"
const $1 = commandFactory<$2>(async ({ path, payload }) => {
return [];
});
export const $1Process = createProcess(
"$3",
["$4"]
);
endsnippet
snippet dmw "Dojo Custom Middleware"
import { create } from '@dojo/framework/core/vdom';
const factory = create();
export const $1 = factory(() => {
return {
run() {},
};
});
export default myMiddleware;
endsnippet
snippet dtest "Dojo Test"
const { describe, it } = intern.getInterface('bdd');
import { tsx } from '@dojo/framework/core/vdom';
import assertionTemplate from '@dojo/framework/testing/assertionTemplate';
import harness from '@dojo/framework/testing/harness';
import $1 from '../../../src/widgets/$1';
import * as css from '../../../src/widgets/$1.m.css';
// Create an assertion
const assertion = assertionTemplate(() => (
<div classes={[css.root]}>
Fix this
</div>
));
describe('$1', () => {
it('default renders correctly', () => {
const h = harness(() => <$1 />);
// Test against my base assertion
h.expect(assertion);
});
});
endsnippet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment