Skip to content

Commit

Permalink
Fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
donato committed Jul 1, 2015
1 parent 13ef4bc commit 3b22662
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/manual/interactive.html
Expand Up @@ -6,6 +6,7 @@
<link type="text/css" rel="stylesheet" href="styles/tests.css" media="all" />

<script src="../../bower_components/jquery/dist/jquery.js"></script>
<script src="../../bower_components/underscore/underscore.js"></script>
<script src="../../bower_components/requirejs/require.js"></script>
</head>
<body>
Expand All @@ -25,35 +26,37 @@ <h1>Show the View with various states</h1>
'view/view'
], function (mockApi, mockModel, View) {

var m = _.extend({}, mockModel);
m.setup();
m.set('id', 'video-container');
var $textarea = $('#modeljson');
mockModel.id = 'video-container';

var view = new View(mockApi, mockModel) ;
var view = new View(mockApi, m) ;

view.setup();
view.resize(400, 300);

mockModel.on('all', updateJson);
m.on('all', updateJson);
updateJson();


function updateJson() {
if ($textarea.is(':focus')) { return; }
$textarea.val(JSON.stringify(mockModel.attrs, null, 4));
$textarea.val(JSON.stringify(m.attrs, null, 4));
}

$textarea.keyup(function() {
try {
var js = JSON.parse($(this).val());
$.each(js, function (key, val) {
mockModel.set(key, val);
m.set(key, val);
});
} catch(e) {
console.log('invalid json');
}
});

window.mockModel = mockModel;
window.mockModel = m;
document.getElementById('video-container').appendChild(view.element());
});

Expand Down
1 change: 1 addition & 0 deletions test/mock/mock-model.js
Expand Up @@ -12,6 +12,7 @@ define([
volume : 50,
controls : true,
stretching : 'uniform',
skin:'seven',
width : 400,
height : 400,
aspectratio : '75%',
Expand Down

0 comments on commit 3b22662

Please sign in to comment.