Skip to content

Commit 842bea6

Browse files
author
Erwan Carriou
committed
- add more unit tests
1 parent 80a40c2 commit 842bea6

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

spec/monoco/component-spec.js

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('a monoco component', function () {
4040
},
4141
'lastName': {
4242
'type': 'string',
43-
'readOnly': true,
43+
'readOnly': false,
4444
'mandatory': true,
4545
'default': ''
4646
},
@@ -94,11 +94,11 @@ describe('a monoco component', function () {
9494
done();
9595
}, 1);
9696
});
97-
97+
9898
it('can add an event on a property change', function (done) {
9999
var system = monoco.system();
100100
share = '';
101-
101+
102102
system.on('version', function (val) {
103103
share = share + 'version';
104104
});
@@ -113,7 +113,7 @@ describe('a monoco component', function () {
113113
it('can remove an event on a property change', function (done) {
114114
var system = monoco.system();
115115
system.off('version');
116-
116+
117117
system.version('0.0.0');
118118

119119
setTimeout(function () {
@@ -147,12 +147,39 @@ describe('a monoco component', function () {
147147
expect(leia.father().children(0).firstName()).toBe('Luke');
148148
});
149149

150+
it('can get a property', function (done) {
151+
setTimeout(function () {
152+
var anakin = monoco.find('Person', { 'firstName': 'Anakin' })[0];
153+
expect(anakin.firstName()).toBe('Anakin');
154+
done();
155+
}, 1);
156+
});
157+
158+
it('can set a property', function (done) {
159+
var anakin = monoco.find('Person', { 'firstName': 'Anakin' })[0];
160+
anakin.lastName('Vador');
161+
162+
setTimeout(function () {
163+
var anakin = monoco.find('Person', { 'firstName': 'Anakin' })[0];
164+
expect(anakin.lastName()).toBe('Vador');
165+
done();
166+
}, 1);
167+
});
168+
169+
it('can get a collection', function (done) {
170+
setTimeout(function () {
171+
var anakin = monoco.find('Person', { 'firstName': 'Anakin' })[0];
172+
expect(anakin.children().length).toBe(1);
173+
done();
174+
}, 1);
175+
});
176+
150177
it('can destroy itself', function (done) {
151-
var anakin = monoco.find('Person', {'firstName': 'Anakin'})[0];
178+
var anakin = monoco.find('Person', { 'firstName': 'Anakin' })[0];
152179
anakin.destroy();
153180

154181
setTimeout(function () {
155-
var result = monoco.find('Person', {'firstName': 'Anakin'});
182+
var result = monoco.find('Person', { 'firstName': 'Anakin' });
156183
expect(result.length).toBe(0);
157184
done();
158185
}, 1);

0 commit comments

Comments
 (0)