popup 0.0.5 → 0.0.6
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.
- data/lib/popup.rb +2 -1
- data/lib/popup/file_ext.rb +5 -0
- data/lib/popup/file_popup.rb +2 -1
- data/lib/popup/save_popup.rb +9 -10
- data/lib/popup/version.rb +1 -1
- data/spec/alert_popup_spec.rb +0 -2
- data/spec/confirm_popup_spec.rb +0 -2
- data/spec/file_popup_spec.rb +0 -2
- data/spec/popup_spec.rb +0 -2
- data/spec/popup_window_spec.rb +0 -2
- data/spec/save_popup_spec.rb +23 -0
- data/spec/spec_helper.rb +2 -1
- metadata +36 -59
data/lib/popup.rb
CHANGED
data/lib/popup/file_ext.rb
CHANGED
@@ -5,6 +5,11 @@ module ATT
|
|
5
5
|
raise FileNotFoundError,"#{file_path} not exist" unless File.file?( window_full_path(file_path) )
|
6
6
|
end
|
7
7
|
|
8
|
+
private
|
9
|
+
def check_file_not_exist?(file_path)
|
10
|
+
raise FileNotFoundError,"#{file_path} has existed" if File.file?( window_full_path(file_path) )
|
11
|
+
end
|
12
|
+
|
8
13
|
private
|
9
14
|
def window_full_path(file_path)
|
10
15
|
path = file_path
|
data/lib/popup/file_popup.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require 'pathname'
|
2
3
|
module ATT
|
3
4
|
class FilePopup < Popup
|
4
5
|
include FileExt
|
5
|
-
CONFIRM_TEXT = [ "OPEN", "打开", "Open" ]
|
6
|
+
CONFIRM_TEXT = [ "OPEN", "打开", "Open","保存","Save","SAVE" ]
|
6
7
|
# Set File Popup with file_path, then click confirm button.
|
7
8
|
# @param file_path
|
8
9
|
# @return: none
|
data/lib/popup/save_popup.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
module ATT
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# for save as dialog
|
3
|
+
class SavePopup < FilePopup
|
4
|
+
|
5
5
|
# Save diaglog as a file
|
6
6
|
# if +file_path+ is relative path, it will be expand to abosulte path join with ATT::Config.root
|
7
7
|
# @param: file_path
|
8
|
-
def
|
9
|
-
|
8
|
+
def set(file_path)
|
9
|
+
check_file_not_exist?(file_path)
|
10
|
+
set_text(file_path)
|
11
|
+
click_confirm
|
10
12
|
end
|
11
13
|
|
12
|
-
alias set
|
13
|
-
|
14
|
-
def confirm_button # :nodoc:
|
15
|
-
@window.button(:instance=>1)
|
16
|
-
end
|
14
|
+
alias click set
|
15
|
+
alias saveas set
|
17
16
|
end
|
18
17
|
end
|
data/lib/popup/version.rb
CHANGED
data/spec/alert_popup_spec.rb
CHANGED
data/spec/confirm_popup_spec.rb
CHANGED
data/spec/file_popup_spec.rb
CHANGED
data/spec/popup_spec.rb
CHANGED
data/spec/popup_window_spec.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ATT::SavePopup do
|
4
|
+
before(:each) do
|
5
|
+
#@b = TestBrowser.get
|
6
|
+
end
|
7
|
+
|
8
|
+
it "#exist?" do
|
9
|
+
window = RAutomation::Window.new(:title=>"notexist")
|
10
|
+
o = ATT::SavePopup.new(window)
|
11
|
+
o.should respond_to("exist?")
|
12
|
+
o.should respond_to("assert_exist?")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "#set #saveas" do
|
16
|
+
window = RAutomation::Window.new(:title=>"notexist")
|
17
|
+
o = ATT::SavePopup.new(window)
|
18
|
+
o.should respond_to("set")
|
19
|
+
o.should respond_to("saveas")
|
20
|
+
|
21
|
+
end
|
22
|
+
#saveas
|
23
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
$LOAD_PATH.unshift File.join(__FILE__,'..','..','lib')
|
2
2
|
require 'popup'
|
3
3
|
require 'rspec'
|
4
|
+
require 'watir'
|
4
5
|
ATT::Config.root = File.join(__FILE__,'..','..','support')
|
5
6
|
|
6
7
|
require 'webserver'
|
@@ -12,7 +13,7 @@ class TestBrowser
|
|
12
13
|
@browser = Watir::Browser.new()
|
13
14
|
@browser.goto("http://localhost:#{@port}/file.html")
|
14
15
|
end
|
15
|
-
at_exit { close }
|
16
|
+
at_exit { close rescue nil }
|
16
17
|
@browser
|
17
18
|
end
|
18
19
|
def self.start_server
|
metadata
CHANGED
@@ -1,57 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: popup
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- yafei Li
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rautomation
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &11017188 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :runtime
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: ffi
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: *11017188
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ffi
|
27
|
+
requirement: &11016912 !ruby/object:Gem::Requirement
|
37
28
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
- 0
|
43
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
44
33
|
type: :runtime
|
45
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *11016912
|
46
36
|
description: popup operation for all windows version.
|
47
37
|
email: lyfi2003@gmail.com
|
48
38
|
executables: []
|
49
|
-
|
50
39
|
extensions: []
|
51
|
-
|
52
40
|
extra_rdoc_files: []
|
53
|
-
|
54
|
-
files:
|
41
|
+
files:
|
55
42
|
- lib/popup/alert_popup.rb
|
56
43
|
- lib/popup/confirm_popup.rb
|
57
44
|
- lib/popup/constants/file_popup.yml
|
@@ -70,6 +57,7 @@ files:
|
|
70
57
|
- spec/file_popup_spec.rb
|
71
58
|
- spec/popup_spec.rb
|
72
59
|
- spec/popup_window_spec.rb
|
60
|
+
- spec/save_popup_spec.rb
|
73
61
|
- spec/spec_helper.rb
|
74
62
|
- spec/webserver.rb
|
75
63
|
- support/file_popup/test.txt
|
@@ -77,39 +65,28 @@ files:
|
|
77
65
|
- support/html_popup/file.html
|
78
66
|
- Rakefile
|
79
67
|
- README.md
|
80
|
-
has_rdoc: true
|
81
68
|
homepage: http://200.200.0.35:81/svn/popup
|
82
69
|
licenses: []
|
83
|
-
|
84
70
|
post_install_message:
|
85
71
|
rdoc_options: []
|
86
|
-
|
87
|
-
require_paths:
|
72
|
+
require_paths:
|
88
73
|
- lib
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
75
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
version: "0"
|
97
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
81
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
segments:
|
103
|
-
- 1
|
104
|
-
- 3
|
105
|
-
- 5
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
106
85
|
version: 1.3.5
|
107
86
|
requirements: []
|
108
|
-
|
109
87
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.10
|
111
89
|
signing_key:
|
112
90
|
specification_version: 3
|
113
91
|
summary: popup operation for all windows version.
|
114
92
|
test_files: []
|
115
|
-
|