Skip to content

Instantly share code, notes, and snippets.

@odoe odoe/typescript.snippets
Last active Sep 3, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.