Refactoring: getting rid of old 'test3' regexp for tests lookup
[fnpeditor.git] / modules / nodePane / metaWidget / metaWidget.test.js
1 define([
2 'libs/chai',
3 'libs/sinon',
4 'modules/nodePane/metaWidget/metaWidget'
5 ], function(chai, sinon, metaWidget) {
6
7 'use strict';
8
9 var assert = chai.assert;
10
11 describe('metaWidget', function() {
12     it('calls calls registered callback on value change', function() {
13         var dom = $('<div>');
14         var widget = metaWidget.create({
15                 el: dom,
16                 attrs: [{name: 'uri', type: 'string', value: 'test string'}],
17             });
18
19         var spy = sinon.spy();
20         widget.on('valueChanged', spy);
21         var input = dom.find('input');
22
23         input.change();
24         assert.ok(spy.calledOnce, 'called once');
25         assert.ok(spy.calledWith('uri', 'test string'), 'called with');
26
27         spy.reset();
28         input.val('new val').change();
29         assert.ok(spy.calledOnce, 'called once');
30         assert.ok(spy.calledWith('uri', 'new val'), 'called with new val');
31     });
32 });
33
34
35 });