Commit graph

352 commits

Author SHA1 Message Date
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
a1fa23397f small fixes to the $location services
* fixing the jsdoc format
* rewriting updateHash() method to be easier to read and so that
  it minifies better
2010-10-18 22:24:44 -07:00
Igor Minar
4bef371e5a fixing css class name for currency filter and its spec 2010-10-18 16:24:43 -07:00
Igor Minar
7059579c74 inline all images into css
* embedded images as data URIs
* rake task to generate multipart js file with embeded images for IE
* move images into a separate directory outside of src or css and
  keep them there for reference
* clean up Rakefile and ruby code
* .gitignore update
* don't penalize IE 8+ with an extra request to the ie-compat.js file
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
1cad16c6f9 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 10:04:15 -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
54090d7766 ng:include should remove the reference to childScope when src is blank 2010-10-16 22:10:01 -07:00
Vojta Jina
b08e2be64c Pass the toKeyValue() test - parsing flags 2010-10-16 22:10:01 -07:00
Misko Hevery
b96f736951 fixed date formater and make it work on ie 2010-10-16 21:43:28 -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
Misko Hevery
de66a319b4 removed unneeded function rethrow from scope which was interfering with the test rethrow function 2010-10-15 10:55:58 -07:00
Misko Hevery
7903f4d940 use new Function instead of eval()
Close #52
2010-10-14 21:49:59 -07:00
Misko Hevery
a7da160c1d publish $route since we bind it with $route.current in ng:include 2010-10-14 15:44:14 -07:00
Misko Hevery
d9c8284ea5 removed stray console.log 2010-10-14 14:52:12 -07:00
Igor Minar
692333f2f5 temporary backwards compatibility patch for 2010-10-14 12:36:29 -07:00
Elliott Sprehn
03df6cbddb New Angular Scenario runner and DSL system with redesigned HTML UI.
Uses the Jasmine syntax for tests, ex:

describe('widgets', function() {
  it('should verify that basic widgets work', function(){
    navigateTo('widgets.html');
    input('text.basic').enter('Carlos');
    expect(binding('text.basic')).toEqual('Carlos');
    input('text.basic').enter('Carlos Santana');
    expect(binding('text.basic')).not().toEqual('Carlos Boozer');
    input('text.password').enter('secret');
    expect(binding('text.password')).toEqual('secret');
    expect(binding('text.hidden')).toEqual('hiddenValue');
    expect(binding('gender')).toEqual('male');
    input('gender').select('female');
    expect(binding('gender')).toEqual('female');
  });
});

Note: To create new UI's implement the interface shown in angular.scenario.ui.Html.
2010-10-14 09:47:39 -07:00
Misko Hevery
0f104317df Added support for date filter
Date filter now supports:
yyyy: four digit year
  yy: two digit year
  MM: two digit month
  dd: two digit day of month
  HH: two digit hour in 0-23
  KK: two digit hour in 0-12
  mm: two digit minute
  ss: two digit second
   a: am/pm
   Z: four digit timezone offset

example {{ timestamp | date:'yyyy-MM-dd HH:mm:ss' }} becomes 2010-10-13 14:45:23
2010-10-13 23:15:40 -07:00
Misko Hevery
805753dba4 fixed issue where date copy creates an object instead of date 2010-10-13 12:47:10 -07:00
Misko Hevery
3ab49538a4 fixed issue where ng:bind would not reset value if expression returned undefined 2010-10-13 10:51:16 -07:00
Misko Hevery
2cb9497d02 Fixed issue where compiler would pass in detached text node if previous markup would have removed it. 2010-10-12 21:52:04 -07:00
Misko Hevery
d9abfe8a7e Introduced injector and $new to scope, and injection into link methods and controllers
- added angular.injector(scope, services, instanceCache) which returns inject
    - inject method can return, instance, or call function which have $inject
      property
    - initialize services with $creation=[eager|eager-publish] this means that
      only some of the services are now globally accessible
  - upgraded $become on scope to use injector hence respect the $inject property
    for injection
    - $become should not be run multiple times and will most likely be removed
      in future version
  - added $new on scope to create a child scope
     - $inject is respected on constructor function
  - simplified scopes so that they no longer have separate __proto__ for
    parent, api, behavior and instance this should speed up execution since
    scope will now create one __proto__ chain per scope (not three).

BACKWARD COMPATIBILITY WARNING:
  - services now need to have $inject instead of inject property for proper
    injection this breaks backward compatibility
  - not all services are now published into root scope
    (only: $location, $cookie, $window)
  - if you have widget/directive which uses services on scope
    (such as this.$xhr), you will now have to inject that service in
    (as it is not published on the root scope anymore)
2010-10-12 16:33:06 -07:00
Igor Minar
7ed2191b07 fixing missing semicolon 2010-10-12 14:48:59 -07:00
Igor Minar
451a711343 fix global namespace polution with invalidWidgets 2010-10-13 04:37:46 +08:00
Igor Minar
70ff7a2639 fix memory leak caused by leftbehind $invalidWidgets references
- ng:switch should not clean up $invalidWidgets
- $invalidWidgets should be clean up after each eval
- add missing docs
2010-10-13 04:37:46 +08:00
Igor Minar
7e47a2d016 temparary backaward compatibility patch for Controller.init
- feedback relies on *Controller.init to be called when a Controller is
being created. this with previous angular refactoring this is not happening
in angular any more. To make it easier for feedback to transition, this
change makes $become call controller's init method if present.

- call to Controller.init from $route.updateRoute was removed. this was
left there by accident during the previous refactoring.
2010-10-13 04:37:45 +08:00
Shyam Seshadri
8490bb921b Fix bug with Lexer not recognizing exponential values and values starting with dots 2010-10-08 20:41:19 -07:00
Misko Hevery
e3ea980c81 fixed leaking constants to gloabal scope 2010-10-08 16:25:12 -07:00
Misko Hevery
772e32c220 change ng:controller to create new scope hence allow nesting 2010-10-08 16:23:26 -07:00
Igor Minar
a930e782a5 removing anchor spec and improving jqLite.trigger() method
- removing the last anchor spec because it can't run reliably in all browsers
- improving jqLite.trigger() method
2010-10-06 10:05:51 -07:00
Elliott Sprehn
8e40e7070d Fix bug in IE where clone removes whitespace nodes. 2010-10-05 07:12:13 +08:00
Igor Minar
81052d4a62 fixed lint warnings 2010-10-04 09:00:09 -07:00
Igor Minar
8248e77a7b 'A' tag widget and ng:click propagation change
* added a widget for A (anchor) tag, that modifies the default behavior
  and prevent default action (location change and page reload) for tags
  with empty href attribute
* stopped event propagation for all ng:click handlers
2010-10-01 07:44:46 +08:00
Igor Minar
0af763dcec properly handle event's stopPropagation() and preventDefault() method in IE 2010-10-01 07:44:45 +08:00
Igor Minar
eb8d46d380 Differentiate between flags and empty keys in $location.hashSearch
* #foo?key=var&flag&emptyKey= should parse into
  {key:'val', flag: true, emptyKey: ''}
* added docs and spec for parseKeyValue function
2010-09-29 09:52:03 -07:00
Igor Minar
984acdc627 Reworked the cookie synchronization between cookie service, $browser and document.cookie.
Now we finally correctly handle situations when browser refuses to set a cookie, due to
storage quota or other (file:// protocol) limitations.
2010-09-27 15:10:05 -07:00
Igor Minar
3eec8c1a51 Properly initialize cookie service in order to preserve existing cookies
- previously the poller initialized the cookie cache too late which
  was causing previously existing cookies to be deleted by cookie service
- refactored the poller api so that the addPollFn returns the added fn
- fixed older cookie service tests
- removed "this.$onEval(PRIORITY_LAST, update);" because it is not needed
2010-09-26 23:54:31 -07:00
Misko Hevery
9171a2b2b5 Added support for functions to $orderBy method
http://github.com/angular/angular.js/issues#issue/23
2010-09-26 19:43:39 +02:00
Misko Hevery
27868f17de cleanup underscore.js form rakefile 2010-09-23 13:53:38 +02:00
Bolek Szewczyk
0d5407bc1e make date validator use the Date object 2010-09-23 13:50:10 +02:00
Misko Hevery
db42221828 fix parseInt by adding radix so that it does not default to octal if the string starts with 0 2010-09-23 13:28:33 +02:00
Igor Minar
acbcfbaf30 $cookies service refactoring
- remove obsolete code in tests
- add warning logs when maximum cookie limits (as specified via RFC 2965) were reached
- non-string values will now get dropped
- after each update $cookies hash will reflect the actual state of browser cookies
  this means that if browser drops some cookies due to cookie overflow, $cookies will reflect that
- $sessionStore got renamed to $cookieStore to avoid name conflicts with html5's sessionStore
2010-09-23 17:23:52 +08:00
Igor Minar
a8931c9021 Rewrite session store service in object literal style and remove getAll method that is not used anywhere 2010-09-23 17:23:43 +08:00
Igor Minar
7cb7fb91c6 Add JSDoc for the copy() method 2010-09-23 17:19:26 +08:00
Misko Hevery
0649009624 Refactored the Browser:
- change from using prototype to inner functions to help with better compression
  - removed watchers (url/cookie) and introduced a poller concept
  - moved the checking of URL and cookie into services which register with poolers
Benefits:
  - Smaller minified file
  - can call $browser.poll() from tests to simulate polling
  - single place where setTimeout needs to be tested
  - More testable $browser
2010-09-22 16:17:44 +02:00
Alkis Evlogimenos
eefb920d0e Reduce copies done by Resource.
When a method foo is called on a Resource object, say myResource there are two copies that happen to the resource:
	- one inside Resource.foo() in some dummy function
	- another inside myResource.$foo() inside the callback passed to foo()
2010-09-22 09:14:50 +02:00
Misko Hevery
006fd2ca25 HEAD is now at 10c0151 Fixes on issue when a SELECT has OPTION which are data bound (ie OPTION has repeater or OPTION.value is bound), then SELECT does not update to match the correct OPTION after the change in model (ie after the OPTION repeater unrolls or OPTION.value is changed.) 2010-09-21 19:20:34 +02:00
Igor Minar
125d725e7d toJson should serialize inherited properties, but not any properties that start with $ 2010-09-21 16:27:47 +02:00