Commit graph

311 commits

Author SHA1 Message Date
Elliott Sprehn
dcf76e6816 Provide better sandbox error messages, and disallow running from file:// URLs 2010-11-02 11:27:54 -07:00
Elliott Sprehn
56a3d52f45 Make future names consistent and handle falsy values in jQuery generated methods properly 2010-11-02 11:20:41 -07:00
Elliott Sprehn
faa7d81b67 Add browser().reload() to simulate a refresh from a user 2010-11-01 17:24:24 -07:00
Elliott Sprehn
6bb2cd6ee2 Provide browser DSL with location() to expect the iframe URL parts. Also move navigateTo() under the browser DSL. 2010-11-01 15:21:37 -07:00
Vojta Jina
99f25050a3 Fixing issue #98 (infinite loop when location hash set empty)
Added tests and fixed the issue.

Closes #98
2010-10-31 21:37:33 -07:00
Elliott Sprehn
9a532002cf Auto generate all the jQuery get/set methods 2010-10-29 12:19:22 -07:00
Elliott Sprehn
5524d2b0fb Check if file exists (not a 404) and that document is accessible and not using file:// URLs in Application 2010-10-29 11:40:56 -07:00
Andres Ornelas
34909520ae add optional label to dsl with selectors to improve test and output readability
e.g.
Before:
   code:   element('.actions ul li a').click();
   output: element .actions ul li a click
After
   code:   element('.actions ul li a', "'Configuration' link").click();
   output: element 'Configuration' link ( .actions ul li a ) click
2010-10-28 15:21:02 -07:00
Elliott Sprehn
92e31b556f Correctly fail tests if no binding matches and add better test cases for failure behavior. 2010-10-27 17:56:44 -07:00
Misko Hevery
62c0e5c460 Fix failing tests for ie, and mark elements as ng-widget, ng-directive, and ng-binding 2010-10-27 15:42:46 -07:00
Igor Minar
72b7a1c531 adding missing angular-mocksSpec.js file 2010-10-26 16:44:59 -07:00
Misko Hevery
9c0225512c fixes IE related failures, and form submit event handling in ie 2010-10-26 16:33:59 -07:00
Elliott Sprehn
40d7e66f40 Lots of bug fixes in the scenario runner and a bunch of new features.
- By default the runner now creates multiple output formats as it runs. Nodes are created in the DOM with ids: json, xml, and html.

ex. $('#json').html() => json output of the runner
ex. $('#xml').html() => json output of the runner

$result is also an object tree result.

The permitted formats are html,json,xml,object.

If you don't want certain formats you can select specific ones with the new ng:scenario-output attribute on the script tag.

<script src="angular-scenario.js" ng:scenario-output="xml,json">

- Added element(...).count() that returns the number of matching elements for the selector.

- repeater(...).count() now returns 0 if no elements matched which can be used to check if a repeater is empty.

- Added toBe() matcher that does strict equality with ===

- Implement iit and ddescribe. If iit() is used instead of it() then only that test will run. If ddescribe() is used instead of describe() them only it() statements inside of it will run. Several iit/ddescribe() blocks can be used to run isolated tests.

- Implement new event based model for SpecRunner. You can now listen for events in the runner. This is useful for writing your own UI or connecting a remote process (ex. WebDriver). Event callbacks execute on the Runner instance.

Events, if fired, will always be in the below order. All events always happen
except for Failure and Error events which only happen in error conditions.

Events:
  RunnerBegin
  SpecBegin(spec)
  StepBegin(spec, step)
  StepError(spec, step, error)
  StepFailure(spec, step, error)
  StepEnd(spec, step)
  SpecError(spec, step, error)
  SpecEnd(spec)
  RunnerEnd

- Only allow the browser to repaint every 10 steps. Cuts 700ms off Firefox in benchmark, 200ms off Chrome.

- Bug Fix: Manually navigate anchors on click since trigger wont work in Firefox.
2010-10-26 15:17:57 -07:00
Misko Hevery
1d52349440 Reverted change 841013a4c4 which does not work on all browsers 2010-10-26 14:25:01 -07:00
Igor Minar
4c61fc01f9 Add TzDate to angular-mocks.js
TzDate is a Date-like type that is independent from the timezone
settings of the machine on which TzDate instances are created.
This property makes it ideal for testing code that deals with
timezones in a manner that makes the code portable between timezones.

Closes #81
2010-10-26 13:47:50 -07:00
Misko Hevery
4fdab37659 create HTML sanitizer to allow inclusion of untrusted HTML in safe manner.
Sanitization works in two phases:
 1) We parse the HTML into sax-like events (start, end, chars).
    HTML parsing is very complex, and so it may very well be that what
    most browser consider valid HTML may not pares properly here,
    but we do best effort. We treat this parser as untrusted.
 2) We have safe sanitizeWriter which treats its input (start, end, chars)
    as untrusted content and escapes everything. It only allows elements
    in the whitelist and only allows attributes which are whitelisted.
    Any attribute value must not start with 'javascript:'. This check
    is performed after escaping for entity (&xAB; etc..) and ignoring
    any whitespace.

 - Correct linky filter to use safeHtmlWriter
 - Correct html filter to use safeHtmlWriter

Close #33; Close #34
2010-10-26 13:41:07 -07:00
Igor Minar
841013a4c4 Add millisecond support for date filter
Date filter should translate input which is a number (or number
string) into a date.
2010-10-25 10:44:03 -07:00
Igor Minar
4e9a2aa10e Revert "added support for treating numbers as date in miliseconds"
This reverts commit 1391f19fb4.
2010-10-23 18:26:47 -07:00
Misko Hevery
1391f19fb4 added support for treating numbers as date in miliseconds 2010-10-23 14:38:08 -07:00
Igor Minar
04a4d8b061 adding ng:submit directive for use with forms
- allows for binding angular expressions to onsubmit events
- prevent default submit action (page reload)
2010-10-23 14:22:54 -07:00
Igor Minar
bbd87c9425 simplifying ng:click spec 2010-10-23 14:22:54 -07:00
Igor Minar
833e0ae343 $cookieStore should not be a global service
you must use $inject to $inject it as any other non-global service
2010-10-23 14:22:30 -07:00
Misko Hevery
d74ef497de Fix for getting into recursive $eval on scope. Close #59
It sort of worked since the browser would throw stack too deep
exception and the angular would then print the error to console.
So as long as you did not have console open you would not notice
this as an error.
2010-10-23 13:42:11 -07:00
Misko Hevery
6ddcf91861 Fix test which was causing the Chrome runner to fail. Upgraded JSTD to latest. Cleanup whitespace. 2010-10-23 13:12:45 -07:00
Misko Hevery
8a867cee22 Workaround for http://bugs.jquery.com/ticket/7292 2010-10-22 22:46:51 -07:00
Misko Hevery
aaabeb8c5e fixed more ie test failures 2010-10-20 23:51:49 -07:00
Misko Hevery
05d4971abb fix some of the failing ie tests 2010-10-20 23:17:59 -07:00
Igor Minar
6f3a757a37 Angular should look for angular-ie-compat file at the right location
The location should be based on the base path of the angular script
and the version identifier of the angular script.

ex: angular.js -> angular-ie-compat.js
    js/angular-0.9.0.min.js -> js/angular-ie-compat-0.9.0.js
2010-10-20 14:48:35 -07:00
Igor Minar
7530eea703 add missing spec for angularJsConfig 2010-10-20 14:48:35 -07:00
Igor Minar
644c8514c5 extract and test regexp that identifies angular script tag 2010-10-20 14:48:35 -07:00
Elliott Sprehn
2115db6903 Lots of stability and performance updates and UI polish too.
Polish the Scenario Runner UI to include:
- a scroll pane that steps appear in since the list can be very long
- Collapse successful tests
- Show the line where the DSL statements were when there's an error (Chrome, Firefox)

Also:
- Remove lots angular.bind calls to reduce the amount of stack space used.
- Use setTimeout(...,0) to schedule the next future to let the browser breathe and have it repaint the steps. Also prevents overflowing the stack when an it() creates many futures.
- Run afterEach() handlers even if the it() block fails.
- Make navigateTo() take a function as the second argument so you can compute a URL in the future.
- Add wait() DSL statement to allow interactive debugging of tests.
- Allow custom jQuery selectors with element(...).query(fn) DSL statement.

Known Issues:
- All afterEach() handlers run even if a beforeEach() handler fails. Only after handlers for the same level as the failure and above should run.
2010-10-20 14:38:00 -07:00
Misko Hevery
9c8b1800b9 fixed negative numbers in Json 2010-10-20 07:22:15 -07:00
Vojta Jina
a27198d52e Added tests for URL_MATCH and fixed issue with empty path
This commit was produced by a combination of 4 commits:
- Added URL_MATCH test for basic url
- Moved two tests from $location to URL_MATCH, as they should be here
- Added test for host without "/" ending and fix the regexp to pass the test
- Added another test for matching empty abs path ("/") and fix the regexp
2010-10-19 21:58:01 -07:00
Misko Hevery
c5cfe2b393 fix date filter to igrone falsy input 2010-10-19 20:38:49 -07:00
Misko Hevery
406373b5db fixed tests 2010-10-19 16:14:16 -07:00
Misko Hevery
01c7abab35 Fix browser triggering in scenario to always do native events.
- Also fixed angular.suffix for scenarios
 - refactored click() to browserTrigger()
 - Fixed Rakefile with CSS and jQuery
2010-10-19 15:56:53 -07:00
Elliott Sprehn
e7e894a2e3 Significantly clean up the way the scenario DSL works and implement many more DSL statements.
- "this" always means the current chain scope inside a DSL

- addFutureAction callbacks now take ($window, $document, done)

- $document has a special method elements() that uses the currently selected nodes in the document as defined by using() statements.

- $document.elements() allows placeholder insertion into selectors to make them more readable.
  ex. $document.elements('input[name="$1"]', myVar) will substitute the value of myVar for $1 in the selector. Subsequent arguments are $2 and so on.

- $document.elements() results have a special method trigger(event) which should be used to events. This method implements some hacks to make sure browser UI controls update and the correct angular events fire.

- futures now allow custom formatting. By default any chain that results in a future can use toJson() or fromJson() to convert the future value to and from json. A custom parser can be provided with parsedWith(fn) where fn is a callback(value) that must return the parsed result.

Note: The entire widgets.html UI is now able to be controlled and asserted through DSL statements!!! Victory! :)
2010-10-19 00:45:38 -07:00
Igor Minar
4bef371e5a fixing css class name for currency filter and its spec 2010-10-18 16:24:43 -07:00
Vojta Jina
d0e55bf446 Removed $location.cancel() method (and related test) 2010-10-18 14:13:48 -07:00
Vojta Jina
341b2b3a9b Update $location API Close #62
update(objOrString)
updateHash(objOrString [, objOrString])
toString()
cancel()

Examples:
$location.update('http://www.angularjs.org/path#path?a=b');
$location.update({port: 443, protocol: 'https'});
$location.updateHash('hashPath');
$location.updateHash({a: 'b'});
$location.updateHash('hashPath', {a: 'b'});

This commit was produced by squash of more commits, here are the old messages:

- Change tests to use update() instead of parse().
- First implementation of update() method
- Test for update() with object parameter
- Add new tests for location, refactor location code
- Add tests for updateHash()
- Implement updateHash()
- Take one or two arguments, could be string - update hashPath, or hash object - update hashSearch...
- Fixed other service tests, to use new $location.update()
Added $location.cancel() method (with test)
Added $location.parse() for back compatability
Remove parse() method
2010-10-18 09:58:37 -07:00
Misko Hevery
9e9bdbdc40 JSON parser is now strict (ie, expressions are not allowed for security)
Close #57
2010-10-18 08:50:36 -07:00
Igor Minar
f24ec0c8f7 improving angular.copy spec 2010-10-16 22:10:01 -07:00
Vojta Jina
46c6406b25 Add test for toKeyValue() - true values should be composed to flag 2010-10-16 22:10:01 -07:00
Vojta Jina
732bcd8a36 Add missing tests for toKeyValue() function 2010-10-16 22:10:01 -07:00
Misko Hevery
ce49c361d7 attempting to fix ie on jquery build failure 2010-10-16 22:08:58 -07:00
Misko Hevery
b96f736951 fixed date formater and make it work on ie 2010-10-16 21:43:28 -07:00
Igor Minar
f8865459d5 adding an extra DateToUTC assertion 2010-10-16 21:31:23 -07:00
Vojta Jina
312f93574e Fixed filter date test - remove dependency on machine timezone
It would be better to separate the time-zone logic to a separate unit and test just this logic.
This logic is simply convert minutes to HH:MM, the source of time-zone is from date object...
2010-10-16 21:29:30 -07:00
Misko Hevery
ff52f47537 Fix unicode parsing Close #56 2010-10-15 14:06:30 -07:00
Misko Hevery
a36964799b fixed lint warnings and one flaky test 2010-10-15 13:44:53 -07:00