test_server 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,15 @@ function result(url, timeout, start_time, result) {
20
20
 
21
21
  }
22
22
 
23
+ $(document).ready(function(){
24
+ $("#clone").click(function () {
25
+
26
+ var popup = window.open(window.location.pathname + '?' + $('form').serialize(), 'Test Server');
27
+ popup.blur();
28
+ window.focus();
29
+ });
30
+ });
31
+
23
32
  $(document).ready(function(){
24
33
  $("#reset").click(function () {
25
34
  $('#form')[0].reset();
@@ -71,7 +71,6 @@ h1 {
71
71
  .ts-button-submit {
72
72
  @extend .btn;
73
73
  @extend .btn-primary;
74
- margin-left: 20px;
75
74
  }
76
75
 
77
76
  .ts-button-close-headline {
@@ -83,6 +82,12 @@ h1 {
83
82
  @extend .btn-default;
84
83
  }
85
84
 
85
+ .ts-button-clone {
86
+ @extend .btn;
87
+ @extend .btn-default;
88
+ margin-left: 10px;
89
+ }
90
+
86
91
  .ts-button-reset {
87
92
  @extend .btn;
88
93
  @extend .btn-default;
@@ -22,12 +22,12 @@ module TestServer
22
22
  param :count, Integer, default: 10
23
23
  param :timeout, Integer, default: 10
24
24
  param :url, String
25
- param :repeat, Boolean, default: false
25
+ param :repeat, String, default: 'false'
26
26
 
27
27
  @count = params[:count]
28
28
  @url = params[:url]
29
29
  @timeout = params[:timeout]
30
- @repeat = params[:repeat]
30
+ @repeat = %w{ on yes true t }.include?(params[:repeat])
31
31
 
32
32
  haml :'xhr/show', layout: :application
33
33
  end
@@ -13,12 +13,18 @@
13
13
  %input#url.ts-field-url{ type: :url, name: :url, value: @url, placeholder: 'http://www.example.org' }
14
14
  .ts-field-repeat
15
15
  %label
16
- %input#repeat{ type: :checkbox, value: @repeat }
17
- = t('views.javascript.xhr.fields.repeat')
16
+ - if @repeat
17
+ %input#repeat{ type: :checkbox, checked: 'checked', value: true, name: :repeat }
18
+ = t('views.javascript.xhr.fields.repeat')
19
+ - else
20
+ %input#repeat{ type: :checkbox, name: :repeat }
21
+ = t('views.javascript.xhr.fields.repeat')
18
22
  %button#submit.ts-button-submit{type: 'submit', name: 'submit', value: t('views.application.buttons.submit'), 'data-toggle' => 'modal', 'data-target' => '#notification'}
19
23
  = t('views.application.buttons.submit')
20
24
  %a#reset.ts-button-reset{href: '#', name: 'reset'}
21
25
  = t('views.application.buttons.reset')
26
+ %a#clone.ts-button-clone{href: '#', name: 'clone'}
27
+ = t('views.application.buttons.clone')
22
28
  %span.ts-inline#request-spinner
23
29
  %img{ src: '/assets/ajax-loader.gif', alt: t('views.javascript.xhr.spinner.text') }
24
30
  = t('views.javascript.xhr.spinner.text')
@@ -47,6 +47,7 @@ en:
47
47
  submit: 'Start'
48
48
  reset: 'Reset'
49
49
  close: 'Close'
50
+ clone: 'Clone'
50
51
  dialogs:
51
52
  notification:
52
53
  title: Notification
@@ -69,5 +70,5 @@ en:
69
70
  timeout: Timeout (ms)
70
71
  status: Status
71
72
  spinner:
72
- text: Requests were sent. Waiting for results.
73
+ text: Waiting for results...
73
74
 
@@ -1,4 +1,4 @@
1
1
  #main TestServer
2
2
  module TestServer
3
- VERSION = '0.1.2'
3
+ VERSION = '0.2.0'
4
4
  end
@@ -54,5 +54,26 @@ describe 'Fetch data via javascript', :js do
54
54
  expect(page).to have_content(url)
55
55
  end
56
56
 
57
+ it 'supports opening a new page based on given values' do
58
+ url = '/v1/test/javascript/xhr/url'
59
+ visit '/xhr/url/'
60
+
61
+ within '#form' do
62
+ fill_in 'url', :with => url
63
+ fill_in 'count', :with => 1
64
+ fill_in 'timeout', :with => 100
65
+ find('#repeat').trigger('click')
66
+ end
67
+
68
+ click_link('clone')
69
+
70
+ within_window 'Test Server' do
71
+ expect(find('#url').value).to eq url
72
+ expect(find('#count').value).to eq '1'
73
+ expect(find('#timeout').value).to eq '100'
74
+ expect(find('#repeat').checked?).to be true
75
+ end
76
+ end
77
+
57
78
  end
58
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-04 00:00:00.000000000 Z
12
+ date: 2014-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler