browserio 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/Gemfile +0 -2
- data/LICENSE.txt +1 -1
- data/README.md +5 -23
- data/Rakefile +1 -8
- data/bin/bio +36 -0
- data/browserio.gemspec +9 -14
- data/lib/browserio.rb +3 -187
- data/lib/browserio/cli.rb +40 -0
- data/lib/browserio/version.rb +1 -1
- metadata +34 -125
- data/lib/browserio/component.rb +0 -326
- data/lib/browserio/config.rb +0 -120
- data/lib/browserio/dom.rb +0 -139
- data/lib/browserio/events.rb +0 -136
- data/lib/browserio/html.rb +0 -29
- data/lib/browserio/opal.rb +0 -18
- data/lib/browserio/plugins/form.rb +0 -343
- data/lib/browserio/plugins/history.rb +0 -92
- data/lib/browserio/plugins/location.rb +0 -78
- data/lib/browserio/plugins/pjax.rb +0 -65
- data/lib/browserio/plugins/validations.rb +0 -251
- data/lib/browserio/utilis/blank.rb +0 -133
- data/lib/browserio/utilis/element.rb +0 -23
- data/lib/browserio/utilis/hash.rb +0 -77
- data/lib/browserio/utilis/indifferent_hash.rb +0 -209
- data/lib/browserio/utilis/methods.rb +0 -25
- data/lib/browserio/utilis/nokogiri.rb +0 -44
- data/lib/browserio/utilis/titleize.rb +0 -97
- data/lib/browserio/utilis/try.rb +0 -106
- data/lib/roda/plugins/browserio.rb +0 -88
- data/test/dummy/app.rb +0 -34
- data/test/dummy/components/bar.rb +0 -16
- data/test/dummy/components/root.rb +0 -39
- data/test/dummy/config.ru +0 -6
- data/test/dummy/forms/foo.rb +0 -6
- data/test/test.js +0 -59
- data/test/test_basic_component.rb +0 -34
- data/test/test_browserio.rb +0 -13
- data/test/test_helper.rb +0 -38
data/test/test.js
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
var page = require('webpage').create();
|
2
|
-
page.settings.localToRemoteUrlAccessEnabled = true;
|
3
|
-
page.settings.resourceTimeout = 1000;
|
4
|
-
// page.content = "<!doctype html>\n<html>\n<head>\new<script type=\"text/javascript\" src=\"https://code.jquery.com/jquery-1.11.2.min.js\"></script>\n</head>\n<body>\n<div id=\"foo\">bar<div>\n</body>\n</html>";
|
5
|
-
var content = '<!doctype html>';
|
6
|
-
content += '<html><head>';
|
7
|
-
content += '<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.min.js"></script>';
|
8
|
-
content += '</head><body>';
|
9
|
-
content += '<h1 id="foo">bar</h1>';
|
10
|
-
content += '</body></html>';
|
11
|
-
|
12
|
-
// page.content = "<div id='foo'>bar</div>";
|
13
|
-
|
14
|
-
page.onConsoleMessage = function(msg) {
|
15
|
-
console.log(msg);
|
16
|
-
};
|
17
|
-
|
18
|
-
page.onResourceTimeout = function(a) {
|
19
|
-
phantom.exit(1);
|
20
|
-
};
|
21
|
-
|
22
|
-
page.onError = function(msg, trace) {
|
23
|
-
|
24
|
-
var msgStack = ['ERROR: ' + msg];
|
25
|
-
|
26
|
-
if (trace && trace.length) {
|
27
|
-
msgStack.push('TRACE:');
|
28
|
-
trace.forEach(function(t) {
|
29
|
-
msgStack.push(' -> ' + t.file + ': ' + t.line + (t.function ? ' (in function "' + t.function +'")' : ''));
|
30
|
-
});
|
31
|
-
}
|
32
|
-
|
33
|
-
console.log(msgStack.join('\n'));
|
34
|
-
phantom.exit();
|
35
|
-
};
|
36
|
-
|
37
|
-
phantom.onError = function(msg, trace) {
|
38
|
-
var msgStack = ['PHANTOM ERROR: ' + msg];
|
39
|
-
if (trace && trace.length) {
|
40
|
-
msgStack.push('TRACE:');
|
41
|
-
trace.forEach(function(t) {
|
42
|
-
msgStack.push(' -> ' + (t.file || t.sourceURL) + ': ' + t.line + (t.function ? ' (in function ' + t.function +')' : ''));
|
43
|
-
});
|
44
|
-
}
|
45
|
-
console.log(msgStack.join('\n'));
|
46
|
-
phantom.exit();
|
47
|
-
};
|
48
|
-
|
49
|
-
page.content = content
|
50
|
-
|
51
|
-
page.onLoadFinished = function() {
|
52
|
-
page.evaluate(function() {
|
53
|
-
console.log($('#foo').html());
|
54
|
-
});
|
55
|
-
phantom.exit();
|
56
|
-
};
|
57
|
-
|
58
|
-
// page.includeJs("http://code.jquery.com/jquery-1.11.2.min.js", function(){
|
59
|
-
// });
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative 'test_helper'
|
2
|
-
|
3
|
-
class BasicComponent < BrowserIO::Component
|
4
|
-
config.name :basic
|
5
|
-
config.html <<-HTML
|
6
|
-
<!DOCTYPE html>
|
7
|
-
<html>
|
8
|
-
<body>
|
9
|
-
<div id='foo'>bar</div>
|
10
|
-
</body>
|
11
|
-
</html>
|
12
|
-
HTML
|
13
|
-
config.dom do
|
14
|
-
tmpl :foo, dom.find('#foo')
|
15
|
-
end
|
16
|
-
|
17
|
-
def foo
|
18
|
-
'bar'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class TestComponent < Minitest::Test
|
23
|
-
def test_calling_basic_component
|
24
|
-
assert_equal 'bar', bio(:basic).foo
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_parsing_html
|
28
|
-
assert_equal '<div id="foo">bar</div>', bio(:basic).tmpl(:foo).to_html
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_returning_js
|
32
|
-
assert bio(:basic, :js).foo[/Opal/]
|
33
|
-
end
|
34
|
-
end
|
data/test/test_browserio.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'phantomjs'
|
2
|
-
require_relative 'test_helper'
|
3
|
-
|
4
|
-
class TestBrowserIO < Minitest::Test
|
5
|
-
def test_javascript_and_source_maps
|
6
|
-
assert BrowserIO.javascript[/Opal/]
|
7
|
-
assert BrowserIO.source_map[/mappings/]
|
8
|
-
end
|
9
|
-
|
10
|
-
# def test_moo
|
11
|
-
# Phantomjs.run('./test/test.js')
|
12
|
-
# end
|
13
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler.setup :default, ENV.fetch('RACK_ENV') { 'development' }
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'minitest/reporters'
|
6
|
-
require 'browserio'
|
7
|
-
|
8
|
-
require 'pry'
|
9
|
-
require 'awesome_print'
|
10
|
-
|
11
|
-
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
|
12
|
-
|
13
|
-
module Minitest
|
14
|
-
class Test
|
15
|
-
extend Minitest::Spec::DSL
|
16
|
-
|
17
|
-
def session
|
18
|
-
@_session ||= OpenStruct.new
|
19
|
-
end
|
20
|
-
|
21
|
-
def bio(*args)
|
22
|
-
BrowserIO[*args]
|
23
|
-
end
|
24
|
-
|
25
|
-
# def app(*args)
|
26
|
-
# a = Class.new(PropertyLink).new
|
27
|
-
#
|
28
|
-
# a.instance_variable_set(:@_request, OpenStruct.new(
|
29
|
-
# session: session,
|
30
|
-
# env: {
|
31
|
-
# 'rack.session' => {}
|
32
|
-
# }
|
33
|
-
# ))
|
34
|
-
#
|
35
|
-
# a.component(*args)
|
36
|
-
# end
|
37
|
-
end
|
38
|
-
end
|