
PhoneGap By Example
By :

There are a lot of testing frameworks nowadays. In general, when we use a framework for testing, we need two things:
Test runner: This is the part of the framework that runs our tests and displays messages telling us whether they have passed or failed.
Assertions: These methods are used for the actual checks. For example, if you need to see whether an active variable is true, then you may write expect(active).toBe(true)
instead of just if(active === true)
. It's just better for the reader of the test, and it also prevents some strange situations, for example, if you want to see whether a variable is defined. The if
statement in the following code returns true
because the status variable has a value, and this value is null
. In fact, we are asking "is the status variable initialized", and if we leave the test like that, we will get wrong results. That's why, we need an assertion library that has proper methods for testing, as shown in the following code...
Change the font size
Change margin width
Change background colour