Displaying Attachment Tag Data with AutoText
The data-text attribute can also be used to display information about an attachment tag itself, by using the tag: prefix in place of the attachment: prefix used above.
This is useful to avoid duplication of information such as the tag description in both the companion file and the custom view source file.
The following tag fields can be displayed, all of which are defined in the companion file:
- name: The name of the tag.
- description: The description of the tag.
- mandatory: Whether the tag must be present on an attachment before the scenario can be executed ("True" or "False")
- usage: Whether only one attachment per scenario can have this tag, or whether several attachments can have the tag at the same time (single-file or multi-file).
The example below demonstrates how to use the data-text attribute to display information about an attachment tag:
<h3>Help with uploading an input spreadsheet</h3> <p data-text="tag:input-sheet/description"></p>As before, a ScenarioObserver must also be configured. In this example, all HTML elements with the data-text attribute are populated with a single observer:
var view = insight.getView(); view.withFirstScenario() .bindAutoText('[data-text]') .start();