Permalink
Browse files

Added a testing suite for the todo list application, using the Siesta…

… framework
  • Loading branch information...
1 parent f64ec65 commit 9e653fc4de1f5565f07f7ba0b43fd80e4174dfaf Adrian Kosmaczewski committed May 3, 2012
Submodule pgkitchensink updated 60 files
+13 −0 .gitignore
+0 −4,135 cordova-1.5.0.js
+70 −0 install.sh
+ libs/images/ajax-loader.png
+ libs/images/icons-18-black.png
+ libs/images/icons-18-white.png
+ libs/images/icons-36-black.png
+ libs/images/icons-36-white.png
+0 −4 libs/jquery-1.7.1.min.js
+0 −1,869 libs/jquery.mobile-1.0.1.css
+0 −7,075 libs/jquery.mobile-1.0.1.js
+0 −2 libs/jquery.mobile-1.0.1.min.css
+0 −177 libs/jquery.mobile-1.0.1.min.js
+0 −736 libs/jquery.mobile.structure-1.0.1.css
+0 −2 libs/jquery.mobile.structure-1.0.1.min.css
+554 −0 native/iOS/KitchenSink/KitchenSink.xcodeproj/project.pbxproj
+50 −0 native/iOS/KitchenSink/KitchenSink/Classes/AppDelegate.h
+140 −0 native/iOS/KitchenSink/KitchenSink/Classes/AppDelegate.m
+36 −0 native/iOS/KitchenSink/KitchenSink/Classes/MainViewController.h
+140 −0 native/iOS/KitchenSink/KitchenSink/Classes/MainViewController.m
+118 −0 native/iOS/KitchenSink/KitchenSink/Classes/MainViewController.xib
+57 −0 native/iOS/KitchenSink/KitchenSink/Cordova.plist
+49 −0 native/iOS/KitchenSink/KitchenSink/KitchenSink-Info.plist
+7 −0 native/iOS/KitchenSink/KitchenSink/KitchenSink-Prefix.pch
+1 −0 native/iOS/KitchenSink/KitchenSink/Plugins/README
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/controls_bg.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/controls_bg@2x.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/controls_bg~ipad.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/microphone.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/microphone@2x.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/microphone~ipad.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/record_button.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/record_button@2x.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/record_button~ipad.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/recording_bg.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/recording_bg@2x.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/recording_bg~ipad.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/stop_button.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/stop_button@2x.png
+ native/iOS/KitchenSink/KitchenSink/Resources/Capture.bundle/stop_button~ipad.png
+26 −0 native/iOS/KitchenSink/KitchenSink/Resources/de.lproj/Localizable.strings
+25 −0 native/iOS/KitchenSink/KitchenSink/Resources/en.lproj/Localizable.strings
+25 −0 native/iOS/KitchenSink/KitchenSink/Resources/es.lproj/Localizable.strings
+ native/iOS/KitchenSink/KitchenSink/Resources/icons/icon-72.png
+ native/iOS/KitchenSink/KitchenSink/Resources/icons/icon.png
+ native/iOS/KitchenSink/KitchenSink/Resources/icons/icon@2x.png
+26 −0 native/iOS/KitchenSink/KitchenSink/Resources/se.lproj/Localizable.strings
+ native/iOS/KitchenSink/KitchenSink/Resources/splash/Default.png
+ native/iOS/KitchenSink/KitchenSink/Resources/splash/Default@2x.png
+2 −0 native/iOS/KitchenSink/KitchenSink/en.lproj/InfoPlist.strings
+35 −0 native/iOS/KitchenSink/KitchenSink/main.m
+12 −0 native/iOS/KitchenSink/KitchenSink/verify.sh
+7 −0 native/iOS/KitchenSink/www/.gitignore
+4,478 −0 native/iOS/KitchenSink/www/cordova-1.7.0.js
+0 −0 www/css/app.css
+ www/images/Compass-Rose.png
+21 −19 www/index.html
+0 −0 www/js/app.js
+0 −0 www/js/seedrandom-min.js
+ www/res/beep.wav
@@ -0,0 +1,27 @@
+Siesta Tests
+============
+
+To use the Siesta library, you should download the Siesta preview from
+the Bryntum forums (file named `siesta-1.1.0-preview.zip`), at this address:
+
+<http://www.bryntum.com/forum/viewtopic.php?f=20&p=11436&sid=a5beb27f443d46e1307a8f980d36ca11#p11436>
+
+Instructions
+------------
+
+1. Download the file referenced in the forum link above.
+2. Copy the zip file to this folder.
+3. Unzip. You should have then a folder named `siesta-1.1.0-preview`
+ alongside this README file.
+4. Open the `index.html` file alongside this README file to run the
+ tests.
+
+Acknowledgements
+----------------
+
+Many thanks to [Mats Bryntse][1] from [Bryntum][2] for providing an early preview of the Siesta
+library for Sencha Touch!
+
+[1]:https://twitter.com/bryntum
+[2]:http://bryntum.com/
+
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <!-- Sencha Touch library CSS-->
+ <link rel="stylesheet" href="../../_libs/sencha/resources/css/sencha-touch.css">
+ <title>Testing with Siesta</title>
+
+ <!-- Siesta CSS -->
+ <link rel="stylesheet" href="siesta-1.1.0-preview/resources/css/siesta-touch-all.css">
+ </head>
+ <body>
+ <div id="splashLoader">
+ <div id="loading">
+ <span class="loadTxt">Loading...</span>
+ <div class="x-loading-spinner"><span class="x-loading-top"></span><span class="x-loading-right"></span><span class="x-loading-bottom"></span><span class="x-loading-left"></span></div>
+ </div>
+ </div>
+
+ <!-- Sencha Touch library -->
+ <script src="../../_libs/sencha/sencha-touch-all-debug.js"></script>
+
+ <!-- Siesta application -->
+ <script src="siesta-1.1.0-preview/siesta-touch-all.js"></script>
+
+ <!-- The test harness -->
+ <script src="index.js"></script>
+ </body>
+</html>
@@ -0,0 +1,27 @@
+var Harness = Siesta.Harness.Browser.SenchaTouch;
+
+Harness.configure({
+ title : 'Testing the To Do List Application',
+ transparentEx : false,
+ loaderPath : { 'ToDoListApp' : '/Sencha%20Touch/todoapp/app' }
+});
+
+// NOTE: This harness assumes you have a local Sencha Touch 2.x SDK at the same place as your Siesta folder.
+
+Harness.start(
+ {
+ group : 'To Do List',
+
+ // Load these files for each ST 2.0 test
+ preload : [
+ "/_libs/sencha/sencha-touch-all-debug.js",
+ "/_libs/sencha/resources/css/sencha-touch.css"
+ ],
+ items : [
+ 'tests/sanity.js',
+ 'tests/model.js',
+ 'tests/createTask.js'
+ ]
+ }
+);
+
@@ -0,0 +1,59 @@
+StartTest(function(t) {
+ t.diag("Create Task");
+
+ t.requireOk([
+ 'ToDoListApp.model.Task',
+ 'ToDoListApp.store.TaskStore',
+ 'ToDoListApp.view.TaskList',
+ 'ToDoListApp.view.TaskForm',
+ 'ToDoListApp.controller.TaskController'
+ ],
+ function() {
+ var grid = Ext.create('ToDoListApp.view.TaskList');
+
+ var form = Ext.create('ToDoListApp.view.TaskForm');
+ Ext.Viewport.add(form);
+
+ t.waitForCQ("formpanel[rendered=true]", Ext.Viewport, function() {
+
+ var titleField = form.down('#titleField');
+ var descriptionField = form.down('#descriptionField');
+
+ var task = Ext.create('ToDoListApp.model.Task');
+ task.set('title', 'Buy milk');
+ task.set('description', 'without fat');
+ form.setRecord(task);
+
+ t.chain({
+ action: 'click',
+ target: titleField
+ },
+ {
+ action: 'click',
+ target: descriptionField
+ },
+ function (next) {
+ t.is(titleField.getValue(), 'Buy milk', 'Title field is OK');
+ t.is(descriptionField.getValue(), 'without fat', 'Title field is OK');
+ next();
+ },
+ function (next) {
+ titleField.setValue('Call friend');
+ descriptionField.setValue('because of birthday');
+ next();
+ },
+ function (next) {
+ t.is(titleField.getValue(), 'Call friend', 'Title field is OK');
+ t.is(descriptionField.getValue(), 'because of birthday', 'Title field is OK');
+ next();
+ },
+ function (next) {
+ var task = form.getRecord();
+ form.updateRecord(task);
+ t.is(task.get('title'), 'Call friend', 'The title field is updated');
+ t.is(task.get('description'), 'because of birthday', 'The description field is updated');
+ });
+ });
+ });
+});
+
@@ -0,0 +1,18 @@
+StartTest(function(t) {
+ t.diag("Testing Task model");
+
+ t.requireOk('ToDoListApp.model.Task', function() {
+ var task = Ext.create('ToDoListApp.model.Task', {
+ title: 'Buy milk',
+ description: 'This is a test task',
+ completed: true,
+ dueDate: new Date()
+ });
+
+ t.is(task.get('title'), 'Buy milk', 'title works ok');
+ t.is(task.get('description'), 'This is a test task', 'Could read description');
+ t.ok(task.get('completed'), 'The task is completed');
+ t.isNot(task.get('dueDate'), null, 'The task date must not be null');
+ });
+});
+
@@ -0,0 +1,12 @@
+StartTest(function(t) {
+ t.diag("Sanity");
+
+ t.ok(Ext, 'Sencha is here');
+
+ t.requireOk('ToDoListApp.view.TaskForm');
+ t.requireOk('ToDoListApp.view.TaskList');
+ t.requireOk('ToDoListApp.store.TaskStore');
+ t.requireOk('ToDoListApp.model.Task');
+ t.requireOk('ToDoListApp.controller.TaskController');
+});
+

0 comments on commit 9e653fc

Please sign in to comment.