Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 9579d40

Browse files
committed
Make channel set lazy and invoke after run all.
(c) Copyright IBM Corp. 2016
1 parent 16df043 commit 9579d40

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

etc/notebooks/tests/Walkthrough-Scala.ipynb

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,35 @@
220220
"val on_aSomething_change = (oldVal: Option[String], newVal: String) => {\n",
221221
" val msg = s\"Hello from on_aNumber_change! Got ${newVal}\"\n",
222222
" channel(\"c\").set(\"message\", msg)\n",
223-
"}\n",
224-
" \n",
225-
"channel(\"c\").watch(\"aSomething\", on_aSomething_change)"
223+
"}"
224+
]
225+
},
226+
{
227+
"cell_type": "code",
228+
"execution_count": null,
229+
"metadata": {
230+
"collapsed": false
231+
},
232+
"outputs": [],
233+
"source": [
234+
"lazy val initChannelWatch = () => {\n",
235+
" channel(\"c\").watch(\"aSomething\", on_aSomething_change)\n",
236+
"}"
237+
]
238+
},
239+
{
240+
"cell_type": "code",
241+
"execution_count": null,
242+
"metadata": {
243+
"collapsed": false
244+
},
245+
"outputs": [],
246+
"source": [
247+
"%%html\n",
248+
"<template is='urth-core-bind'>\n",
249+
" <urth-core-function id='icw' ref='initChannelWatch'></urth-core-function>\n",
250+
" <button onClick='icw.invoke()'>initChannelWatch</button><br/>\n",
251+
"</template>"
226252
]
227253
},
228254
{
@@ -387,7 +413,7 @@
387413
],
388414
"metadata": {
389415
"kernelspec": {
390-
"display_name": "Scala 2.10.4",
416+
"display_name": "Apache Toree (Scala 2.10.4)",
391417
"language": "scala",
392418
"name": "scala"
393419
},

system-test/urth-core-bind-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var boilerplate = new Boilerplate();
77

88
describe('Urth Core Bind', function() {
99

10-
boilerplate.setup(this.title, '/notebooks/tests/urth-core-bind.ipynb');
10+
boilerplate.setup(this.title, '/notebooks/tests/urth-core-bind.ipynb', 3);
1111

1212
it('should wait for dependency to load', function(done) {
1313
// Using a random number to protect against the possibility of a previous

system-test/urth-r-widgets-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var Boilerplate = require('./utils/boilerplate');
66
var boilerplate = new Boilerplate();
77

88
process.env.PYTHON != "python2" && describe('Widgets R System Test', function() {
9-
boilerplate.setup(this.title, '/notebooks/tests/urth-r-widgets.ipynb');
9+
boilerplate.setup(this.title, '/notebooks/tests/urth-r-widgets.ipynb', 7);
1010

1111
it('should print the result of a Function Widget invocation', function(done) {
1212
boilerplate.browser

system-test/urth-system-test-specs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ describe('Widgets Python System Test', function() {
7070
});
7171
});
7272

73-
describe('Widgets Scala System Test', function() {
74-
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 8);
73+
process.env.PYTHON != "python2" && describe('Widgets Scala System Test', function() {
74+
boilerplate.setup(this.title, '/notebooks/tests/Walkthrough-Scala.ipynb', 9);
7575

7676
var timeout = 30000;
7777

@@ -116,6 +116,7 @@ describe('Widgets Scala System Test', function() {
116116

117117
it('should watch for changes in a watched variable', function(done) {
118118
boilerplate.browser
119+
.elementByXPath('//button[text()="initChannelWatch"]').click()
119120
.elementsByCssSelector('div.code_cell').nth(8)
120121
.elementByCssSelector('>', 'input')
121122
.type('watched message')

system-test/utils/boilerplate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ Boilerplate.prototype.setup = function(testName, startingURL, outputCount){
7474
var outputAsserter = new wd.Asserter(
7575
function(target) { // browser or el
7676
return target
77-
.elementsByCss('div.output_area').then(function(nodes) {
78-
nodes.should.have.length(outputCount);
77+
.elementsByCssSelector('div.output_area').then(function(nodes) {
78+
console.log(nodes.length+"/"+outputCount)
79+
nodes.should.have.length.above(outputCount-1);
7980
return target; // this will be returned by waitFor
8081
// and ignored by waitForElement.
8182
})

0 commit comments

Comments
 (0)