jasmine-headless-webkit 0.7.1 → 0.7.2

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.
@@ -1,86 +0,0 @@
1
- require 'jasmine/files_list'
2
- require 'multi_json'
3
-
4
- module Jasmine
5
- class TemplateWriter
6
- class << self
7
- def write!(files_list)
8
- output = [
9
- [ "specrunner.#{$$}.html", files_list.files_to_html ]
10
- ]
11
-
12
- output.unshift([ "specrunner.#{$$}.filter.html", files_list.filtered_files_to_html ]) if files_list.filtered?
13
-
14
- output.each do |name, files|
15
- File.open(name, 'w') { |fh| fh.print template_for(files, files_list.spec_file_line_numbers) }
16
- end
17
-
18
- output.collect(&:first)
19
- end
20
-
21
- private
22
- def template_for(files, spec_lines)
23
- <<-HTML
24
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
25
- <html>
26
- <head>
27
- <meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
28
- <title>Jasmine Test Runner</title>
29
- <script type="text/javascript">
30
- window.console = { log: function(data) {
31
- if (typeof(jQuery) !== 'undefined' && data instanceof jQuery) {
32
- JHW.log(style_html($("<div />").append(data).html(), { indent_size: 2 }));
33
- } else {
34
- var usejsDump = true;
35
- try {
36
- if (typeof data.toJSON == 'function') {
37
- JHW.log("JSON: " + JSON.stringify(data, null, 2));
38
- usejsDump = false;
39
- }
40
- } catch (e) {}
41
-
42
- if (usejsDump) {
43
- var dump = jsDump.doParse(data);
44
- if (dump.indexOf("\\n") == -1) {
45
- JHW.log(dump);
46
- } else {
47
- JHW.log("jsDump: " + dump);
48
- }
49
- }
50
- }
51
- }, pp: function(data) {
52
- JHW.log(jasmine ? jasmine.pp(data) : JSON.stringify(data));
53
- } };
54
-
55
- window.onbeforeunload = function(e) {
56
- JHW.leavePageAttempt('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
57
-
58
- if (e = e || window.event) {
59
- e.returnValue = "leaving";
60
- }
61
-
62
- return "leaving";
63
- };
64
- </script>
65
- #{files.join("\n")}
66
- <script type="text/javascript">
67
- HeadlessReporterResult.specLineNumbers = #{MultiJson.encode(spec_lines)};
68
- </script>
69
- </head>
70
- <body>
71
-
72
- <script type="text/javascript">
73
- jasmine.getEnv().addReporter(new jasmine.HeadlessReporter(function() {
74
- window.onbeforeunload = null;
75
- }));
76
- jasmine.getEnv().execute();
77
- </script>
78
-
79
- </body>
80
- </html>
81
- HTML
82
- end
83
- end
84
- end
85
- end
86
-
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
- require 'jasmine/template_writer'
3
- require 'fakefs/spec_helpers'
4
-
5
- describe Jasmine::TemplateWriter do
6
- describe '.write!' do
7
- include FakeFS::SpecHelpers
8
-
9
- let(:files_list) { Jasmine::FilesList.new }
10
-
11
- before do
12
- files_list.files << 'file.js'
13
- files_list.filtered_files << 'file.js'
14
- end
15
-
16
- context 'no filter' do
17
- it 'should write one file' do
18
- Jasmine::TemplateWriter.write!(files_list).should == [
19
- "specrunner.#{$$}.html"
20
- ]
21
- end
22
- end
23
-
24
- context 'filtered files' do
25
- before do
26
- files_list.files << 'file2.js'
27
- end
28
-
29
- it 'should write two files' do
30
- Jasmine::TemplateWriter.write!(files_list).should == [
31
- "specrunner.#{$$}.filter.html", "specrunner.#{$$}.html"
32
- ]
33
- end
34
- end
35
- end
36
- end
37
-