ende 0.4.15 → 0.4.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +1 -0
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +5 -1
- data/lib/assets/javascripts/widgets/list/presenter.js.coffee +4 -5
- data/lib/assets/javascripts/widgets/support/adapters/olark.js +1 -1
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +94 -30
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/components/ende_build.js +30 -61
- data/vendor/components/indefinido-observable/component.json +3 -7
- data/vendor/components/indefinido-observable/lib/observable.js +19 -9
- metadata +2 -59
- data/build/build.css +0 -111
- data/vendor/components/indefinido-observable/.gitignore +0 -15
- data/vendor/components/indefinido-observable/.ruby-gemset +0 -1
- data/vendor/components/indefinido-observable/.ruby-version +0 -1
- data/vendor/components/indefinido-observable/Gemfile +0 -13
- data/vendor/components/indefinido-observable/Guardfile +0 -39
- data/vendor/components/indefinido-observable/History.md +0 -0
- data/vendor/components/indefinido-observable/Readme.md +0 -116
- data/vendor/components/indefinido-observable/build/build.js +0 -14798
- data/vendor/components/indefinido-observable/build/development.js +0 -339
- data/vendor/components/indefinido-observable/build/release.js +0 -14937
- data/vendor/components/indefinido-observable/build/test.js +0 -339
- data/vendor/components/indefinido-observable/components/chaijs-chai/component.json +0 -46
- data/vendor/components/indefinido-observable/components/chaijs-chai/index.js +0 -1
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/assertion.js +0 -132
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/error.js +0 -60
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/assert.js +0 -1060
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/interface/should.js +0 -76
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/eql.js +0 -124
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/index.js +0 -108
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/inspect.js +0 -316
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/test.js +0 -26
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai/utils/type.js +0 -45
- data/vendor/components/indefinido-observable/components/chaijs-chai/lib/chai.js +0 -79
- data/vendor/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
- data/vendor/components/indefinido-observable/components/component-jquery/component.json +0 -14
- data/vendor/components/indefinido-observable/components/component-jquery/index.js +0 -9601
- data/vendor/components/indefinido-observable/components/kapit-observe-shim/component.json +0 -11
- data/vendor/components/indefinido-observable/components/kapit-observe-utils/component.json +0 -13
- data/vendor/components/indefinido-observable/karma.conf.js +0 -92
- data/vendor/components/indefinido-observable/spec/legacy/observable_spec.js +0 -126
- data/vendor/components/indefinido-observable/spec/observable_spec.js +0 -92
- data/vendor/components/indefinido-observable/spec/spec_helper.js +0 -8
- data/vendor/components/indefinido-observable/spec/vendor/accessors_spec.js +0 -63
- data/vendor/components/indefinido-observable/src/lib/adapters/rivets.js.coffee +0 -15
- data/vendor/components/indefinido-observable/src/spec/legacy/observable_spec.coffee +0 -132
- data/vendor/components/indefinido-observable/src/spec/observable_spec.coffee +0 -85
- data/vendor/components/indefinido-observable/src/spec/spec_helper.coffee +0 -5
- data/vendor/components/indefinido-observable/src/spec/vendor/accessors_spec.coffee +0 -59
- data/vendor/components/indefinido-observable/vendor/spec/boot.js +0 -104
- data/vendor/components/indefinido-observable/vendor/spec/jasmine.js +0 -2054
@@ -1,11 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "observe-shim",
|
3
|
-
"version": "0.1.1",
|
4
|
-
"main": "lib/observe-shim.js",
|
5
|
-
"devDependencies": {
|
6
|
-
"mocha": "~1.8.x",
|
7
|
-
"expect": "~0.2.0",
|
8
|
-
"sinon": "http://sinonjs.org/releases/sinon-1.6.0.js"
|
9
|
-
},
|
10
|
-
"repo": "https://raw.github.com/kapit/observe-shim"
|
11
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "observe-utils",
|
3
|
-
"version": "0.1.0",
|
4
|
-
"main": "lib/observe-utils.js",
|
5
|
-
"devDependencies": {
|
6
|
-
"expect": "~0.2.0",
|
7
|
-
"sinon": "http://sinonjs.org/releases/sinon-1.6.0.js",
|
8
|
-
"observe-shim": "https://github.com/KapIT/observe-shim.git",
|
9
|
-
"mocha": "~1.8.1",
|
10
|
-
"es5-shim": "~2.0.8"
|
11
|
-
},
|
12
|
-
"repo": "https://raw.github.com/kapit/observe-utils"
|
13
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
// Karma configuration
|
2
|
-
|
3
|
-
module.exports = function(config) {
|
4
|
-
config.set({
|
5
|
-
// base path, that will be used to resolve files and exclude
|
6
|
-
basePath: '',
|
7
|
-
|
8
|
-
// list of files / patterns to load in the browser
|
9
|
-
files: [
|
10
|
-
|
11
|
-
// Test environment
|
12
|
-
//MOCHA, Switch to mocha when not testing ie
|
13
|
-
//MOCHA_ADAPTER,
|
14
|
-
JASMINE,
|
15
|
-
JASMINE_ADAPTER,
|
16
|
-
'components/cjohansen-sinon/sinon.js',
|
17
|
-
|
18
|
-
// Test dependencies
|
19
|
-
'build/test.js',
|
20
|
-
|
21
|
-
// Test Source files
|
22
|
-
'spec/spec_helper.js',
|
23
|
-
'spec/**/*.js'
|
24
|
-
],
|
25
|
-
|
26
|
-
|
27
|
-
// list of files to exclude
|
28
|
-
exclude: [
|
29
|
-
'spec/coverage'
|
30
|
-
],
|
31
|
-
|
32
|
-
// Custom frameworks
|
33
|
-
frameworks: ['jasmine'],
|
34
|
-
|
35
|
-
|
36
|
-
// test results reporter to use
|
37
|
-
// possible values: 'dots', 'progress', 'junit'
|
38
|
-
reporters: ['progress'], // , 'coverage'],
|
39
|
-
|
40
|
-
|
41
|
-
// web server port
|
42
|
-
port: 9876,
|
43
|
-
|
44
|
-
|
45
|
-
// cli runner port
|
46
|
-
runnerPort: 9100,
|
47
|
-
|
48
|
-
|
49
|
-
// enable / disable colors in the output (reporters and logs)
|
50
|
-
colors: true,
|
51
|
-
|
52
|
-
|
53
|
-
// level of logging
|
54
|
-
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
|
55
|
-
logLevel: LOG_INFO,
|
56
|
-
|
57
|
-
|
58
|
-
// enable / disable watching file and executing tests whenever any file changes
|
59
|
-
autoWatch: true,
|
60
|
-
|
61
|
-
|
62
|
-
// Start these browsers, currently available:
|
63
|
-
// - Chrome
|
64
|
-
// - ChromeCanary
|
65
|
-
// - Firefox
|
66
|
-
// - Opera
|
67
|
-
// - Safari (only Mac)
|
68
|
-
// - PhantomJS
|
69
|
-
// - IE (only Windows)
|
70
|
-
browsers: ['Chrome'],
|
71
|
-
|
72
|
-
|
73
|
-
// If browser does not capture in given timeout [ms], kill it
|
74
|
-
captureTimeout: 60000,
|
75
|
-
|
76
|
-
|
77
|
-
// Continuous Integration mode
|
78
|
-
// if true, it capture browsers, run tests and exit
|
79
|
-
singleRun: false,
|
80
|
-
|
81
|
-
// Coverage preprocessors
|
82
|
-
// preprocessors: {
|
83
|
-
// '**/lib/*.js': 'coverage'
|
84
|
-
// },
|
85
|
-
|
86
|
-
// Converage configuration
|
87
|
-
coverageReporter: {
|
88
|
-
type : 'html',
|
89
|
-
dir : 'spec/coverage'
|
90
|
-
}
|
91
|
-
});
|
92
|
-
}
|
@@ -1,126 +0,0 @@
|
|
1
|
-
var $, observable, root;
|
2
|
-
|
3
|
-
observable = require('observable').mixin;
|
4
|
-
|
5
|
-
root = typeof exports !== "undefined" && exports !== null ? exports : window;
|
6
|
-
|
7
|
-
$ = require('jquery');
|
8
|
-
|
9
|
-
describe('observable #()', function() {
|
10
|
-
var object;
|
11
|
-
|
12
|
-
object = null;
|
13
|
-
beforeEach(function() {
|
14
|
-
return object = {
|
15
|
-
property: 'value'
|
16
|
-
};
|
17
|
-
});
|
18
|
-
it('should not have observed property', function() {
|
19
|
-
return expect(object.observed).toBeUndefined();
|
20
|
-
});
|
21
|
-
xit('should let element unsubscribe to property', function() {});
|
22
|
-
describe('#subscribe', function() {
|
23
|
-
var called;
|
24
|
-
|
25
|
-
called = null;
|
26
|
-
beforeEach(function() {
|
27
|
-
object = observable({});
|
28
|
-
called = false;
|
29
|
-
return true;
|
30
|
-
});
|
31
|
-
it('should subscribe to property', function() {
|
32
|
-
var spy;
|
33
|
-
|
34
|
-
spy = sinon.spy();
|
35
|
-
object.subscribe('other', spy);
|
36
|
-
object.other = 'mafagafo';
|
37
|
-
return expect(spy.called).toBe(true);
|
38
|
-
});
|
39
|
-
it('should let multiple function subscriptions to property', function() {
|
40
|
-
var also_also_called, also_called;
|
41
|
-
|
42
|
-
also_called = false;
|
43
|
-
also_also_called = false;
|
44
|
-
object.subscribe('other', function() {
|
45
|
-
return called = true;
|
46
|
-
});
|
47
|
-
object.subscribe('other', function() {
|
48
|
-
return also_called = true;
|
49
|
-
});
|
50
|
-
object.subscribe('other', function() {
|
51
|
-
return also_also_called = true;
|
52
|
-
});
|
53
|
-
object.other = 'mafagafo';
|
54
|
-
expect(called).toBe(true);
|
55
|
-
return expect(also_called).toBe(true);
|
56
|
-
});
|
57
|
-
it('should handle truth comparisons well', function() {
|
58
|
-
var block_called, spy;
|
59
|
-
|
60
|
-
spy = sinon.spy;
|
61
|
-
block_called = false;
|
62
|
-
object.invert = true;
|
63
|
-
object.truthy = true;
|
64
|
-
object.falsey = false;
|
65
|
-
object.subscribe('truthy', spy);
|
66
|
-
object.subscribe('falsey', spy);
|
67
|
-
object.subscribe('invert', spy);
|
68
|
-
block_called = false;
|
69
|
-
if (object.truthy) {
|
70
|
-
block_called = true;
|
71
|
-
}
|
72
|
-
expect(block_called).toBe(true);
|
73
|
-
block_called = false;
|
74
|
-
if (!object.falsey) {
|
75
|
-
block_called = true;
|
76
|
-
}
|
77
|
-
expect(block_called).toBe(true);
|
78
|
-
block_called = false;
|
79
|
-
if (object.invert) {
|
80
|
-
block_called = true;
|
81
|
-
}
|
82
|
-
object.invert = false;
|
83
|
-
block_called = false;
|
84
|
-
if (object.invert === false) {
|
85
|
-
block_called = true;
|
86
|
-
}
|
87
|
-
return expect(block_called).toBe(true);
|
88
|
-
});
|
89
|
-
describe('subscribes to properties of type array', function() {
|
90
|
-
it('should observe objects added to array', function() {
|
91
|
-
var friend, spy;
|
92
|
-
|
93
|
-
spy = sinon.spy();
|
94
|
-
friend = {
|
95
|
-
domo: 1
|
96
|
-
};
|
97
|
-
object.friends = [];
|
98
|
-
object.subscribe('friends', function() {});
|
99
|
-
object.friends = [friend];
|
100
|
-
friend = object.friends[0];
|
101
|
-
expect(friend.domo).toBeDefined();
|
102
|
-
expect(friend.observed).toBeDefined();
|
103
|
-
friend.subscribe('domo', spy);
|
104
|
-
friend.domo = 2;
|
105
|
-
return expect(spy.callCount).toBe(1);
|
106
|
-
});
|
107
|
-
it('should override native methods');
|
108
|
-
return it('should preserve array bindings when setting new array', function() {
|
109
|
-
var spy;
|
110
|
-
|
111
|
-
spy = sinon.spy();
|
112
|
-
object.friends = [];
|
113
|
-
object.subscribe('friends', spy);
|
114
|
-
object.friends.push(1);
|
115
|
-
object.friends = [];
|
116
|
-
object.friends.push(2);
|
117
|
-
expect(object.friends.length).toBe(1);
|
118
|
-
return expect(spy.callCount).toBe(3);
|
119
|
-
});
|
120
|
-
});
|
121
|
-
return it('should create a observed property', function() {});
|
122
|
-
});
|
123
|
-
return xdescribe('#publish', function() {
|
124
|
-
return xit('should let element publish to property', function() {});
|
125
|
-
});
|
126
|
-
});
|
@@ -1,92 +0,0 @@
|
|
1
|
-
var observable, root;
|
2
|
-
|
3
|
-
observable = require('observable').mixin;
|
4
|
-
|
5
|
-
root = typeof exports !== "undefined" && exports !== null ? exports : window;
|
6
|
-
|
7
|
-
describe('observable #()', function() {
|
8
|
-
var object;
|
9
|
-
|
10
|
-
if (!root.should) {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
object = null;
|
14
|
-
beforeEach(function() {
|
15
|
-
return object = {
|
16
|
-
property: 'value'
|
17
|
-
};
|
18
|
-
});
|
19
|
-
it('should not have observed property', function() {
|
20
|
-
return object.should.not.have.property('observed');
|
21
|
-
});
|
22
|
-
xit('should let element unsubscribe to property', function() {});
|
23
|
-
describe('#subscribe', function() {
|
24
|
-
var called;
|
25
|
-
|
26
|
-
called = null;
|
27
|
-
beforeEach(function() {
|
28
|
-
object = observable({});
|
29
|
-
called = false;
|
30
|
-
return true;
|
31
|
-
});
|
32
|
-
it('should subscribe to property', function() {
|
33
|
-
var spy;
|
34
|
-
|
35
|
-
spy = sinon.spy();
|
36
|
-
object.subscribe('other', spy);
|
37
|
-
object.other = 'mafagafo';
|
38
|
-
return spy.called.should.be["true"];
|
39
|
-
});
|
40
|
-
it('should let multiple function subscriptions to property', function() {
|
41
|
-
var also_called;
|
42
|
-
|
43
|
-
also_called = false;
|
44
|
-
object.subscribe('other', function() {
|
45
|
-
return called = true;
|
46
|
-
});
|
47
|
-
object.subscribe('other', function() {
|
48
|
-
return also_called = true;
|
49
|
-
});
|
50
|
-
object.other = 'mafagafo';
|
51
|
-
called.should.be["true"];
|
52
|
-
return also_called.should.be["true"];
|
53
|
-
});
|
54
|
-
describe('subscribes to properties of type array', function() {
|
55
|
-
it('should observe objects added to array', function() {
|
56
|
-
var friend, spy;
|
57
|
-
|
58
|
-
spy = sinon.spy();
|
59
|
-
friend = {
|
60
|
-
domo: 1
|
61
|
-
};
|
62
|
-
object.friends = [];
|
63
|
-
object.subscribe('friends', function() {});
|
64
|
-
object.friends = [friend];
|
65
|
-
object.friends[0].should.be.eq(friend);
|
66
|
-
friend.should.have.property('observed');
|
67
|
-
friend.subscribe('domo', spy);
|
68
|
-
friend.domo = 2;
|
69
|
-
return spy.callCount.should.be.eq(1);
|
70
|
-
});
|
71
|
-
xit('should override native methods');
|
72
|
-
return it('should preserve array bindings when setting new array', function() {
|
73
|
-
var spy;
|
74
|
-
|
75
|
-
spy = sinon.spy();
|
76
|
-
object.friends = [];
|
77
|
-
object.subscribe('friends', spy);
|
78
|
-
object.friends.push(1);
|
79
|
-
object.friends = [];
|
80
|
-
object.friends.push(2);
|
81
|
-
object.friends.length.should.be.eq(1);
|
82
|
-
return spy.callCount.should.be.eq(3);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
return it('should create a observed property', function() {
|
86
|
-
return object.should.have.property('observed');
|
87
|
-
});
|
88
|
-
});
|
89
|
-
return xdescribe('#publish', function() {
|
90
|
-
return xit('should let element publish to property', function() {});
|
91
|
-
});
|
92
|
-
});
|
@@ -1,63 +0,0 @@
|
|
1
|
-
var $;
|
2
|
-
|
3
|
-
require('observable/vendor/shims/accessors.js');
|
4
|
-
|
5
|
-
$ = require('jquery');
|
6
|
-
|
7
|
-
describe('Object #defineProperty', function() {
|
8
|
-
describe('on dom elements', function() {
|
9
|
-
var object, spy;
|
10
|
-
|
11
|
-
spy = object = null;
|
12
|
-
beforeEach(function() {
|
13
|
-
object = document.createElement('domo');
|
14
|
-
document.body.appendChild(object);
|
15
|
-
return spy = sinon.spy();
|
16
|
-
});
|
17
|
-
it('should define property', function(done) {
|
18
|
-
return Object.defineProperty(object, 'kun', {});
|
19
|
-
});
|
20
|
-
it('should define property getter', function(done) {
|
21
|
-
var getter;
|
22
|
-
|
23
|
-
getter = sinon.stub().returns(42);
|
24
|
-
Object.defineProperty(object, 'kun', {
|
25
|
-
get: getter
|
26
|
-
});
|
27
|
-
expect(object.kun + 1).toBe(43);
|
28
|
-
return expect(getter.called).toBe(true);
|
29
|
-
});
|
30
|
-
return it('should define property setter', function(done) {
|
31
|
-
Object.defineProperty(object, 'kun', {
|
32
|
-
set: spy
|
33
|
-
});
|
34
|
-
object.kun = 10;
|
35
|
-
return expect(spy.calledWith(10)).toBe(true);
|
36
|
-
});
|
37
|
-
});
|
38
|
-
return describe('off dom elements', function() {
|
39
|
-
beforeEach(function() {
|
40
|
-
this.object = {};
|
41
|
-
return this.spy = sinon.spy();
|
42
|
-
});
|
43
|
-
it('should not define property setter', function(done) {
|
44
|
-
var _this = this;
|
45
|
-
|
46
|
-
return expect(function() {
|
47
|
-
return Object.defineProperty(_this.object, 'kun', {
|
48
|
-
set: _this.spy
|
49
|
-
});
|
50
|
-
}).toThrow();
|
51
|
-
});
|
52
|
-
return it('should define property getter', function(done) {
|
53
|
-
var getter;
|
54
|
-
|
55
|
-
getter = sinon.stub().returns(42);
|
56
|
-
Object.defineProperty(this.object, 'kun', {
|
57
|
-
get: getter
|
58
|
-
});
|
59
|
-
expect(this.object.kun + 1).toBe(43);
|
60
|
-
return expect(getter.called).toBe(true);
|
61
|
-
});
|
62
|
-
});
|
63
|
-
});
|
@@ -1,15 +0,0 @@
|
|
1
|
-
exports.adapter =
|
2
|
-
subscribe: (record, attribute_path, callback) ->
|
3
|
-
throw new TypeError 'observable.adapters.rivets.subscribe: No record provided for subscription' unless record?
|
4
|
-
# TODO parse aura widget attributes options, remove, add as a
|
5
|
-
# comentary, and let rivets bindings flow, and remove the if check
|
6
|
-
record.subscribe attribute_path, callback if attribute_path
|
7
|
-
unsubscribe: (record, attribute_path, callback) ->
|
8
|
-
throw new TypeError 'observable.adapters.rivets.unsubscribe: No record provided for subscription' unless record?
|
9
|
-
record.unsubscribe attribute_path, callback
|
10
|
-
read: (record, attribute_path) ->
|
11
|
-
throw new TypeError 'observable.adapters.rivets.read: No record provided for subscription' unless record?
|
12
|
-
record[attribute_path]
|
13
|
-
publish: (record, attribute_path, value) ->
|
14
|
-
throw new TypeError 'observable.adapters.rivets.publish: No record provided for subscription' unless record?
|
15
|
-
record[attribute_path] = value
|
@@ -1,132 +0,0 @@
|
|
1
|
-
observable = require('observable').mixin
|
2
|
-
root = exports ? window
|
3
|
-
$ = require 'jquery'
|
4
|
-
|
5
|
-
describe 'observable #()', ->
|
6
|
-
|
7
|
-
object = null
|
8
|
-
|
9
|
-
beforeEach ->
|
10
|
-
object = property: 'value'
|
11
|
-
|
12
|
-
it 'should not have observed property', ->
|
13
|
-
expect(object.observed).toBeUndefined()
|
14
|
-
|
15
|
-
xit 'should let element unsubscribe to property', ->
|
16
|
-
|
17
|
-
describe '#subscribe', ->
|
18
|
-
called = null
|
19
|
-
|
20
|
-
beforeEach ->
|
21
|
-
object = observable({})
|
22
|
-
called = false
|
23
|
-
true
|
24
|
-
|
25
|
-
it 'should subscribe to property', ->
|
26
|
-
spy = sinon.spy()
|
27
|
-
object.subscribe 'other', spy
|
28
|
-
object.other = 'mafagafo'
|
29
|
-
|
30
|
-
expect(spy.called).toBe true
|
31
|
-
|
32
|
-
|
33
|
-
it 'should let multiple function subscriptions to property', ->
|
34
|
-
also_called = false
|
35
|
-
also_also_called = false
|
36
|
-
|
37
|
-
object.subscribe 'other', -> called = true
|
38
|
-
|
39
|
-
object.subscribe 'other', -> also_called = true
|
40
|
-
|
41
|
-
object.subscribe 'other', -> also_also_called = true
|
42
|
-
|
43
|
-
object.other = 'mafagafo'
|
44
|
-
|
45
|
-
expect(called).toBe true
|
46
|
-
expect(also_called).toBe true
|
47
|
-
|
48
|
-
it 'should handle truth comparisons well', ->
|
49
|
-
spy = sinon.spy
|
50
|
-
block_called = false
|
51
|
-
object.invert = true
|
52
|
-
object.truthy = true
|
53
|
-
object.falsey = false
|
54
|
-
|
55
|
-
object.subscribe 'truthy', spy
|
56
|
-
object.subscribe 'falsey' , spy
|
57
|
-
object.subscribe 'invert', spy
|
58
|
-
|
59
|
-
block_called = false
|
60
|
-
if object.truthy
|
61
|
-
# dump 'truthy'
|
62
|
-
block_called = true
|
63
|
-
|
64
|
-
expect(block_called).toBe true
|
65
|
-
|
66
|
-
block_called = false
|
67
|
-
# dump (object.falsey + '') == 'false'
|
68
|
-
unless object.falsey
|
69
|
-
# dump 'falsey'
|
70
|
-
block_called = true
|
71
|
-
|
72
|
-
expect(block_called).toBe true
|
73
|
-
|
74
|
-
block_called = false
|
75
|
-
if object.invert
|
76
|
-
# dump 'invert'
|
77
|
-
block_called = true
|
78
|
-
|
79
|
-
object.invert = false
|
80
|
-
|
81
|
-
block_called = false
|
82
|
-
if object.invert == false
|
83
|
-
# dump 'inverted'
|
84
|
-
block_called = true
|
85
|
-
|
86
|
-
expect(block_called).toBe true
|
87
|
-
|
88
|
-
|
89
|
-
describe 'subscribes to properties of type array', ->
|
90
|
-
it 'should observe objects added to array', ->
|
91
|
-
spy = sinon.spy()
|
92
|
-
friend = {domo: 1}
|
93
|
-
|
94
|
-
# TODO implement a one time setter to solve this
|
95
|
-
# Specifically on array types
|
96
|
-
# property must be an array before subscribing
|
97
|
-
object.friends = []
|
98
|
-
|
99
|
-
# Remember, you must subscribe to new properties to
|
100
|
-
# turn then into observable ones
|
101
|
-
object.subscribe 'friends', ->
|
102
|
-
|
103
|
-
object.friends = [friend]
|
104
|
-
friend = object.friends[0]
|
105
|
-
|
106
|
-
expect(friend.domo ).toBeDefined()
|
107
|
-
expect(friend.observed).toBeDefined()
|
108
|
-
|
109
|
-
friend.subscribe 'domo', spy
|
110
|
-
friend.domo = 2
|
111
|
-
expect(spy.callCount).toBe 1
|
112
|
-
|
113
|
-
it 'should override native methods'
|
114
|
-
|
115
|
-
it 'should preserve array bindings when setting new array', ->
|
116
|
-
spy = sinon.spy()
|
117
|
-
object.friends = []
|
118
|
-
object.subscribe 'friends', spy
|
119
|
-
|
120
|
-
object.friends.push 1
|
121
|
-
object.friends = []
|
122
|
-
object.friends.push 2
|
123
|
-
|
124
|
-
expect(object.friends.length).toBe 1
|
125
|
-
expect(spy.callCount).toBe 3
|
126
|
-
|
127
|
-
it 'should create a observed property', ->
|
128
|
-
# object.should.have.property 'observed'
|
129
|
-
|
130
|
-
xdescribe '#publish', ->
|
131
|
-
|
132
|
-
xit 'should let element publish to property', ->
|
@@ -1,85 +0,0 @@
|
|
1
|
-
observable = require('observable').mixin
|
2
|
-
root = exports ? window
|
3
|
-
|
4
|
-
describe 'observable #()', ->
|
5
|
-
return unless root.should
|
6
|
-
|
7
|
-
object = null
|
8
|
-
|
9
|
-
beforeEach ->
|
10
|
-
object = property: 'value'
|
11
|
-
|
12
|
-
it 'should not have observed property', ->
|
13
|
-
object.should.not.have.property 'observed'
|
14
|
-
|
15
|
-
xit 'should let element unsubscribe to property', ->
|
16
|
-
|
17
|
-
describe '#subscribe', ->
|
18
|
-
called = null
|
19
|
-
|
20
|
-
beforeEach ->
|
21
|
-
object = observable({})
|
22
|
-
called = false
|
23
|
-
true
|
24
|
-
|
25
|
-
it 'should subscribe to property', ->
|
26
|
-
spy = sinon.spy()
|
27
|
-
object.subscribe 'other', spy
|
28
|
-
|
29
|
-
object.other = 'mafagafo'
|
30
|
-
spy.called.should.be.true
|
31
|
-
|
32
|
-
it 'should let multiple function subscriptions to property', ->
|
33
|
-
also_called = false
|
34
|
-
|
35
|
-
object.subscribe 'other', -> called = true
|
36
|
-
|
37
|
-
object.subscribe 'other', -> also_called = true
|
38
|
-
|
39
|
-
object.other = 'mafagafo'
|
40
|
-
called.should.be.true
|
41
|
-
also_called.should.be.true
|
42
|
-
|
43
|
-
describe 'subscribes to properties of type array', ->
|
44
|
-
it 'should observe objects added to array', ->
|
45
|
-
spy = sinon.spy()
|
46
|
-
friend = {domo: 1}
|
47
|
-
|
48
|
-
# TODO implement a one time setter to solve this
|
49
|
-
# Specifically on array types
|
50
|
-
# property must be an array before subscribing
|
51
|
-
object.friends = []
|
52
|
-
|
53
|
-
# Remember, you must subscribe to new properties to
|
54
|
-
# turn then into observable ones
|
55
|
-
object.subscribe 'friends', ->
|
56
|
-
|
57
|
-
object.friends = [friend]
|
58
|
-
|
59
|
-
object.friends[0].should.be.eq friend
|
60
|
-
friend.should.have.property 'observed'
|
61
|
-
|
62
|
-
friend.subscribe 'domo', spy
|
63
|
-
friend.domo = 2
|
64
|
-
spy.callCount.should.be.eq 1
|
65
|
-
|
66
|
-
xit 'should override native methods'
|
67
|
-
it 'should preserve array bindings when setting new array', ->
|
68
|
-
spy = sinon.spy()
|
69
|
-
object.friends = []
|
70
|
-
object.subscribe 'friends', spy
|
71
|
-
|
72
|
-
object.friends.push 1
|
73
|
-
object.friends = []
|
74
|
-
object.friends.push 2
|
75
|
-
|
76
|
-
object.friends.length.should.be.eq 1
|
77
|
-
spy.callCount.should.be.eq 3
|
78
|
-
|
79
|
-
|
80
|
-
it 'should create a observed property', ->
|
81
|
-
object.should.have.property 'observed'
|
82
|
-
|
83
|
-
xdescribe '#publish', ->
|
84
|
-
|
85
|
-
xit 'should let element publish to property', ->
|