forked from jejacks0n/mercury
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic, basic tests. But really they need more detail before merge.
- Loading branch information
Showing
6 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@javascript | ||
Feature: | ||
As a content editor type person | ||
In order to manage content | ||
I should be able to manipulate text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
describe "Mercury.Regions.Image", -> | ||
|
||
template 'mercury/regions/image.html' | ||
|
||
beforeEach -> | ||
@regionElement = $('#editable_region1') | ||
|
||
describe "constructor", -> | ||
|
||
beforeEach -> | ||
@buildSpy = spyOn(Mercury.Regions.Image.prototype, 'build').andCallFake(=>) | ||
@bindEventsSpy = spyOn(Mercury.Regions.Image.prototype, 'bindEvents').andCallFake(=>) | ||
|
||
it "expects an element and window", -> | ||
@region = new Mercury.Regions.Image(@regionElement, window) | ||
expect(@region.element.get(0)).toEqual($('#editable_region1').get(0)) | ||
expect(@region.window).toEqual(window) | ||
|
||
it "accepts options", -> | ||
@region = new Mercury.Regions.Image(@regionElement, window, {foo: 'something'}) | ||
expect(@region.options).toEqual({foo: 'something'}) | ||
|
||
it "sets it's type", -> | ||
@region = new Mercury.Regions.Image(@regionElement, window) | ||
expect(@region.type).toEqual('image') | ||
|
||
it "calls build", -> | ||
@region = new Mercury.Regions.Image(@regionElement, window) | ||
expect(@buildSpy.callCount).toEqual(1) | ||
|
||
it "calls bindEvents", -> | ||
@region = new Mercury.Regions.Image(@regionElement, window) | ||
expect(@bindEventsSpy.callCount).toEqual(1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe "Mercury.Regions.Simple", -> | ||
|
||
template 'mercury/regions/simple.html' | ||
|
||
beforeEach -> | ||
@regionElement = $('#editable_region1') | ||
|
||
describe "constructor", -> | ||
|
||
beforeEach -> | ||
@buildSpy = spyOn(Mercury.Regions.Simple.prototype, 'build').andCallFake(=>) | ||
@bindEventsSpy = spyOn(Mercury.Regions.Simple.prototype, 'bindEvents').andCallFake(=>) | ||
|
||
it "expects an element and window", -> | ||
@region = new Mercury.Regions.Simple(@regionElement, window) | ||
expect(@region.element.get(0)).toEqual($('#editable_region1').get(0)) | ||
expect(@region.window).toEqual(window) | ||
|
||
it "accepts options", -> | ||
@region = new Mercury.Regions.Simple(@regionElement, window, {foo: 'something'}) | ||
expect(@region.options).toEqual({foo: 'something'}) | ||
|
||
it "sets it's type", -> | ||
@region = new Mercury.Regions.Simple(@regionElement, window) | ||
expect(@region.type).toEqual('simple') | ||
|
||
it "calls build", -> | ||
@region = new Mercury.Regions.Simple(@regionElement, window) | ||
expect(@buildSpy.callCount).toEqual(1) | ||
|
||
it "calls bindEvents", -> | ||
@region = new Mercury.Regions.Simple(@regionElement, window) | ||
expect(@bindEventsSpy.callCount).toEqual(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<img id="editable_region1" src="foo.jpg" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div id="editable_region1"> | ||
|
||
</div> |