Skip to content

Commit

Permalink
Merge pull request #37 from cantino/fix-guard
Browse files Browse the repository at this point in the history
Fix guard pattern issue
  • Loading branch information
cantino authored Jan 24, 2023
2 parents 10b8d1b + cc15553 commit 6aa7560
Show file tree
Hide file tree
Showing 17 changed files with 1,794 additions and 188 deletions.
6 changes: 3 additions & 3 deletions Guardfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ require 'yui/compressor'
require 'fileutils'

# Specs
guard 'coffeescript', :input => 'spec', :output => 'spec/compiled', :all_on_start => true
guard 'coffeescript', :input => 'spec', :output => 'spec/compiled', :patterns => [%r{^.+\.(?:coffee|coffee\.md|litcoffee)$}], :all_on_start => true

# Core Code

FileUtils.mkdir_p File.join(File.dirname(__FILE__), 'build', 'js')
FileUtils.mkdir_p File.join(File.dirname(__FILE__), 'build', 'css')

guard 'coffeescript', :input => 'lib/js', :output => 'build/js', :all_on_start => true
guard 'coffeescript', :input => 'lib/js', :output => 'build/js', :patterns => [%r{^.+\.(?:coffee|coffee\.md|litcoffee)$}], :all_on_start => true
guard 'sass', :input => 'lib/css', :output => 'build/css', :all_on_start => true, :line_numbers => true

guard 'concat',
:all_on_start => true,
:type => "js",
:files => %w(vendor/jquery build/js/jquery-include vendor/diff/diff_match_patch build/js/core/dom build/js/core/core),
:files => %w(vendor/jquery build/js/jquery-include vendor/diff/diff_match_patch build/js/dom build/js/core),
:input_dir => ".",
:output => "build/selectorgadget_combined"

Expand Down
40 changes: 40 additions & 0 deletions build/js/core-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(function() {
describe("SelectorGadget", function() {
var sg;
sg = null;
beforeEach(function() {
return sg = new SelectorGadget();
});
return describe("composeRemoteUrl", function() {
it("works with no existing query", function() {
expect(sg.composeRemoteUrl("http://www.blah.com").split("?")[0]).toEqual("http://www.blah.com");
expect(sg.composeRemoteUrl("http://www.blah.com").split("?")[1].split("&")[0].split("=")[0]).toEqual("t");
expect(sg.composeRemoteUrl("http://www.blah.com").split("?")[1].split("&")[1].split("=")[0]).toEqual("url");
expect(sg.composeRemoteUrl("http://www.blah.com", {
blah: "hi"
}).split("?")[1].split("&")[2].split("=")[0]).toEqual("blah");
return expect(sg.composeRemoteUrl("http://www.blah.com", {
blah: "hi"
}).split("?")[1].split("&")[2].split("=")[1]).toEqual("hi");
});
return it("works with an existing query", function() {
var url;
url = "http://www.blah.com?a=b&c=d";
expect(sg.composeRemoteUrl(url).split("?")[0]).toEqual("http://www.blah.com");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[0].split("=")[0]).toEqual("a");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[0].split("=")[1]).toEqual("b");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[1].split("=")[0]).toEqual("c");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[1].split("=")[1]).toEqual("d");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[2].split("=")[0]).toEqual("t");
expect(sg.composeRemoteUrl(url).split("?")[1].split("&")[3].split("=")[0]).toEqual("url");
expect(sg.composeRemoteUrl(url, {
blah: "hi"
}).split("?")[1].split("&")[4].split("=")[0]).toEqual("blah");
return expect(sg.composeRemoteUrl(url, {
blah: "hi"
}).split("?")[1].split("&")[4].split("=")[1]).toEqual("hi");
});
});
});

}).call(this);
9 changes: 4 additions & 5 deletions build/js/core/core.js → build/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

*/

(function() {
var SelectorGadget;

window.SelectorGadget = SelectorGadget = (function() {

function SelectorGadget() {}

SelectorGadget.prototype.border_width = 5;
Expand Down Expand Up @@ -225,7 +223,7 @@
};

SelectorGadget.prototype.highlightIframe = function(elem, click) {
var block, instructions, p, self, src, target;
var block, e, instructions, p, self, src, target;
p = elem.offset();
self = this;
target = jQuerySG(click.target);
Expand All @@ -246,7 +244,8 @@
src = null;
try {
src = elem.contents().get(0).location.href;
} catch (e) {
} catch (error) {
e = error;
src = elem.attr("src");
}
instructions.append(jQuerySG("<a target='_top'>click here to open it</a>").attr("href", src));
Expand Down
269 changes: 269 additions & 0 deletions build/js/dom-spec.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6aa7560

Please sign in to comment.