editor: canvas - stop using thrown away nodeMoved event, use 'move' flag instead
[fnpeditor.git] / src / editor / modules / nodePane / metaWidget / metaWidget.test.js
1 define([
2 'libs/jquery',
3 'libs/chai',
4 'libs/sinon',
5 'modules/nodePane/metaWidget/metaWidget'
6 ], function($, chai, sinon, metaWidget) {
7
8 'use strict';
9 /* globals describe, it */
10
11 var assert = chai.assert;
12
13 describe('metaWidget', function() {
14     it('calls calls registered callback on value change', function() {
15         var dom = $('<div>');
16         var widget = metaWidget.create({
17                 el: dom,
18                 attrs: {'uri': {type: 'string', value: 'test string'}},
19             });
20
21         var spy = sinon.spy();
22         widget.on('valueChanged', spy);
23         var input = dom.find('input');
24
25         input.change();
26         assert.ok(spy.calledOnce, 'called once');
27         assert.ok(spy.calledWith('uri', 'test string'), 'called with');
28
29         spy.reset();
30         input.val('new val').change();
31         assert.ok(spy.calledOnce, 'called once');
32         assert.ok(spy.calledWith('uri', 'new val'), 'called with new val');
33     });
34 });
35
36
37 });