Skip to content

Commit

Permalink
Add definition and test for $.pjax.submit function.
Browse files Browse the repository at this point in the history
It is nearly same with $.pjax.click function.
  • Loading branch information
lijunle committed Jun 18, 2014
1 parent 0e5cb04 commit 37d2280
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jquery.pjax/jquery.pjax-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ function test_click() {
$.pjax.click(event, { container: "#pjax-container" });
$.pjax.click(event, "#pjax-container", { push: true });
}

function test_submit() {
var event = $.Event("submit");
$.pjax.submit(event, "#pjax-container");
$.pjax.submit(event, { container: "#pjax-container" });
$.pjax.submit(event, "#pjax-container", { push: true });
}
21 changes: 21 additions & 0 deletions jquery.pjax/jquery.pjax.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,25 @@ interface PjaxStatic {
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
*/
click(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void;

/**
* PJAX on form submit handler
* @param event A jQuery click event.
* @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:
* - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
* - push: a boolean indicates whether to pushState the URL. Default is true.
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
*/
submit(event: JQueryEventObject, options?: PjaxSettings): void;

/**
* PJAX on form submit handler
* @param event A jQuery click event.
* @param containerSelector A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody).
* @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options:
* - container: a jQuery selector indicates where to stick the response body. The `containerSelector` parameter has priority.
* - push: a boolean indicates whether to pushState the URL. Default is true.
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
*/
submit(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void;
}

0 comments on commit 37d2280

Please sign in to comment.