Drafts: Standard Test Content16 Jul 2020
When I’m creating Drafts actions and testing them out, I quite often need test data to work with. Rather than creating test data each time, I figured I should sort out some standard test data. While I could certainly have used a tool like TextExpander, which Drafts notably supports natively on i*OS, I decided instead to roll it into some actions, and in this post I’m going to explain a little bit about that and how you can make use of them too.
The example data is available through the use of the Thought Asylum Drafts Library (TADpoLe), and the ThoughtAsylum Action Group contains a set of actions in the “Sample Content” section to provide quick and easy access.
- TAD-Create Plain Text Example Draft
- TAD-Create Simple List Example Draft
- TAD-Create Taskpaper Example Draft
- TAD-Create Markdown Example Draft
- TAD-Create MultiMarkdown Example Draft
- TAD-Create Github Markdown Example Draft
Each of these actions creates and loads a new draft in the editor containing the relevant example data, and setting the syntax for the draft to match.
draft.TA_newExample_PlainText(); editor.TA_cursorToStart(); editor.activate();
The first line varies, but the function names all begin
TA_newExample_, and the documentation for the functions can be found on the TADpoLe sub site. The second and third lines are common throughout and simply put the cursor at the start of the draft and activate the editor.
The content of each of the draft examples is available on Github. Some of them may even be useful as examples working outside of Drafts.
Drafts Syntax Tests Repository
I find having some standardised content that broadly covers most syntax-based use cases is really handy when testing my actions. I hope you get some use out of this example content in your own testing, and and that you can ultimately create actions quicker and of great quality as a result.