Просмотр исходного кода

improvements to the automated tests doc

Adam Shaw 11 лет назад
Родитель
Сommit
2ed274d1f2
1 измененных файлов с 13 добавлено и 3 удалено
  1. 13 3
      tests/automated_test_readme.md

+ 13 - 3
tests/automated_test_readme.md

@@ -92,7 +92,7 @@ The cool thing is that when a test name is read outloud, with all of its ancestr
 
 Similar to how `iRTL` often calls for nested groupings, the `lang` option will often influence the behavior of other settings. Please test for different `lang` values when necessary. It will probably only be necessary to test for the default `lang` as well as one non-default lang. The inner describe statement might look like `"when lang is fr"` (for French).
 
-Also, similar to how `isRTL` often calls for nested groupings, please also make different groupings for each type of view (just "basic" and "agenda" for now). This is very necessary, especially for settings that affect rendering, because often the code paths for each view are completely different. It might look something like this:
+Also, similar to how `isRTL` often calls for nested groupings, please also make different groupings for each type of view. Usually, testing for one "basic" view (month/basicWeek/basicDay) is okay, as well as one "agenda" view (agendaWeek/agendaDay). This is very necessary, especially for settings that affect rendering, because often the code paths for each view are completely different. It might look something like this:
 
 	describe('weekNumbers', function() {
 		beforeEach(function() {
@@ -128,15 +128,21 @@ Also, similar to how `isRTL` often calls for nested groupings, please also make
 
 We are mostly doing "black box testing", which means we don't care about testing the internals, mainly just the input and output. For most options, this will entail inspecting the DOM to see if the option had the desired effect. This might involve checking an element for certain text, a certain className, or a certain pixel width. An example of this can be seen with [minTime].
 
-The [jasmine-jquery] library is available to make it easier to query the DOM for certain things. It provides extra utility methods on all jQuery elements.
+To test callbacks (like [eventClick]), please simulate a real user mouse event using the jQuery `trigger` method. Then, to determine if the callback has been called, use [Jasmine's asynchronous support].
 
+To test API methods (like [updateEvent]), call the method with a healthy variety of arguments and make sure the desired output occurs, whether by querying DOM or querying the internal state of the calendar with a different method. Also, make sure all the proper callbacks have been called (if applicable).
 
-# Tips for debugging tests
+
+# Tips
 
 When you are writing a new test, it is often annoying to have to run *all* tests every time while you are debugging. Jasmine allows you to write `ddescribe` and `iit` statements, which will only run the enclosed tests and ignore all others.
 
 Also, when running tests in a real browers via the plain `karma start` command, it is very helpful to use Karma's "debug" mode (available via the big DEBUG button). Once you are in that mode, JS debugging tools such as console and breakpoints will become available.
 
+The [jasmine-jquery] library is available to make it easier to query the DOM for certain things. It adds extra DOM-specific utility methods to the `expect()` object.
+
+The [jasmine-fixture] library is available to make it easier to create and attach DOM elements through the `affix` method. They also automatically get cleaned up after each `it` statement runs.
+
 
 # Code formatting of tests
 
@@ -155,3 +161,7 @@ If you have any questions on what to tests, or how to organize your tests, post
 [How to create a PR]: https://help.github.com/articles/creating-a-pull-request
 [minTime]: https://github.com/arshaw/fullcalendar/blob/v2/tests/automated/minTime.js
 [jasmine-jquery]: https://github.com/velesin/jasmine-jquery
+[jasmine-fixture]: https://github.com/searls/jasmine-fixture
+[Jasmine's asynchronous support]: http://jasmine.github.io/2.0/introduction.html#section-Asynchronous_Support
+[eventClick]: http://arshaw.com/fullcalendar/docs2/mouse/eventClick/
+[updateEvent]: http://arshaw.com/fullcalendar/docs2/event_data/updateEvent/