Book Image

Learning JavaScriptMVC

By : Wojciech Bednarski
Book Image

Learning JavaScriptMVC

By: Wojciech Bednarski

Overview of this book

<p>JavaScriptMVC is a client-side, JavaScript framework that builds maintainable, error-free, lightweight applications as quickly as possible. As it does not depend on server components, it can be combined with any web service interface and server-side language.<br /><br />"Learning JavaScriptMVC" will guide you through all the framework aspects and show you how to build small- to mid-size well-structured and documented client-side applications you will love to work on.<br /><br />This book starts from JavaScriptMVC installation and all its components are explained with practical examples. It finishes with an example of building a web application. You will learn what the JavaScriptMVC framework is, how to install it, and how to use it efficiently.<br /><br />This book will guide you on how to build a sample application from scratch, test its codebase using unit testing, as well as test the whole application using functional testing, document it, and deploy the same. After reading Learning JavaScriptMVC you will learn how to install the framework and create a well-structured, documented and maintainable client-side application.</p>
Table of Contents (13 chapters)

Creating tests


Creating tests is writing a code that runs against application code to ensure that the code meets its design and behaves as intended. Writing tests can save time by finding bugs at the early development stage.

Lets add our first test for the Todo app:

  1. In the Todo/todo folder, create a folder named tests. Inside it, create a file named todo_test.html with following content:

    <!doctype html>
    
    <html>
      <head>
        <title>Todo List - tests</title>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="../../funcunit/qunit/qunit.css" />
      </head>
      <body>
        <h1 id="qunit-header">AutoSuggest Test Suite</h1>
    
        <h2 id="qunit-banner"></h2>
    
        <div id="qunit-testrunner-toolbar"></div>
        <h2 id="qunit-userAgent"></h2>
        <ol id="qunit-tests"></ol>
     <script src="../../steal/steal.js?todo/tests/todo_test.js"></script>	
      </body>
    </html>

    This...