Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
221
Merge Requests
221
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
7f7df402
Commit
7f7df402
authored
Nov 22, 2009
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#623310
by rfay: Fixed AJAX 'changed' command asterisk argument.
parent
6ff73ad0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
includes/ajax.inc
includes/ajax.inc
+1
-1
modules/simpletest/tests/ajax.test
modules/simpletest/tests/ajax.test
+5
-0
modules/simpletest/tests/ajax_forms_test.module
modules/simpletest/tests/ajax_forms_test.module
+17
-8
No files found.
includes/ajax.inc
View file @
7f7df402
...
...
@@ -720,7 +720,7 @@ function ajax_command_changed($selector, $asterisk = '') {
return
array
(
'command'
=>
'changed'
,
'selector'
=>
$selector
,
'
star
'
=>
$asterisk
,
'
asterisk
'
=>
$asterisk
,
);
}
...
...
modules/simpletest/tests/ajax.test
View file @
7f7df402
...
...
@@ -107,6 +107,11 @@ class AJAXCommandsTestCase extends AJAXTestCase {
$command
=
$commands
[
1
];
$this
->
assertTrue
(
$command
[
'command'
]
==
'changed'
&&
$command
[
'selector'
]
==
'#changed_div'
,
"'changed' AJAX command issued with correct selector"
);
// Tests the 'changed' command using the second argument.
$commands
=
$this
->
drupalPostAJAX
(
$form_path
,
$edit
,
'changed_command_asterisk_example'
);
$command
=
$commands
[
1
];
$this
->
assertTrue
(
$command
[
'command'
]
==
'changed'
&&
$command
[
'selector'
]
==
'#changed_div'
&&
$command
[
'asterisk'
]
==
'#changed_div_mark_this'
,
"'changed' AJAX command (with asterisk) issued with correct selector"
);
// 'css' command will go here when it is implemented.
// Tests the 'data' command.
...
...
modules/simpletest/tests/ajax_forms_test.module
View file @
7f7df402
...
...
@@ -130,7 +130,7 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) {
'#suffix'
=>
'<div id="before_div">Insert something before this.</div>'
,
);
// Shows the 'changed' command.
// Shows the 'changed' command
without asterisk
.
$form
[
'changed_command_example'
]
=
array
(
'#value'
=>
t
(
"AJAX changed: Click to mark div changed."
),
'#type'
=>
'submit'
,
...
...
@@ -139,6 +139,14 @@ function ajax_forms_test_ajax_commands_form($form, &$form_state) {
),
'#suffix'
=>
'<div id="changed_div"> <div id="changed_div_mark_this">This div can be marked as changed or not.</div></div>'
,
);
// Shows the 'changed' command adding the asterisk.
$form
[
'changed_command_asterisk_example'
]
=
array
(
'#value'
=>
t
(
"AJAX changed: Click to mark div changed with asterisk."
),
'#type'
=>
'submit'
,
'#ajax'
=>
array
(
'callback'
=>
'ajax_forms_test_advanced_commands_changed_asterisk_callback'
,
),
);
// Shows the AJAX 'css' command.
// @todo Note that this won't work until http://drupal.org/node/623320 lands.
...
...
@@ -264,14 +272,15 @@ function ajax_forms_test_advanced_commands_before_callback($form, $form_state) {
* AJAX callback for 'changed'.
*/
function
ajax_forms_test_advanced_commands_changed_callback
(
$form
,
$form_state
)
{
$checkbox_value
=
$form_state
[
'values'
][
'changed_command_example'
];
$checkbox_value_string
=
$checkbox_value
?
"TRUE"
:
"FALSE"
;
$commands
[]
=
ajax_command_changed
(
'#changed_div'
);
return
array
(
'#type'
=>
'ajax_commands'
,
'#ajax_commands'
=>
$commands
);
}
/**
* AJAX callback for 'changed' with asterisk marking inner div.
*/
function
ajax_forms_test_advanced_commands_changed_asterisk_callback
(
$form
,
$form_state
)
{
$commands
=
array
();
if
(
$checkbox_value
)
{
// @todo This does not yet exercise the 2nd arg (asterisk) so that should
// be added when it works.
$commands
[]
=
ajax_command_changed
(
'#changed_div'
);
}
$commands
[]
=
ajax_command_changed
(
'#changed_div'
,
'#changed_div_mark_this'
);
return
array
(
'#type'
=>
'ajax_commands'
,
'#ajax_commands'
=>
$commands
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment