Input Length Check Unit Test
  • 10 Oct 2023
  • 1 Minute to read
  • Contributors

Input Length Check Unit Test


Article summary

This application explains how to setup and use the Input Length Check custom widget.

INSERT VIDEO HERE

Purpose

The purpose of the Input Length Check Unit Test is to allow users to learn and understand how to setup and use the Input Length Check custom widget in their Tulip applications. Custom widgets are coded widgets that sit on top of the Tulip platform to give additional functionality that is not currently part of the main platform. This specific custom widget allows the user to set the allowed maximum number of characters for an input, and checks if it meets the criteria or not.

Setup

Custom Widget Plugins interact with your application through the use of properties and events. Prop are the shared data that exists between your application and widget, while Events are signals that your widget can send to your application. In your app editor you can build triggers based off these events. Events can be made to send data to your application as well.

The following props and events are used in the Input Length Check Custom Widget:
INPUT: Can be string or integer. This is where you enter the input, which length is restricted.
MAX LENGTH: Can be integer only. This is the maximum number of characters the input is allowed to be.
WRONG INPUT: This event fires when the legnth of the input is longer than the maximum allowed number.
EMPTY VARIABLE ERROR: This event occurs when the MAX LENGTH variable is not defined.

How it Works

The Input Length Check custom widget enables the user to predefine a maximum number of allowed characters in the MAX LENGTH prop, and then checks the INPUT prop length if it meets this criteria or not. If it's longer than allowed, the widget triggers an event and truncates the INPUT prop back to the allowed length as well.


Was this article helpful?