Skip to content

Commit 76e876f

Browse files
FIX Ensure changetracker notes first change in WYSIWYG (#1954)
1 parent b68f641 commit 76e876f

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

client/dist/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/legacy/HtmlEditorField.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ ss.editorWrappers.tinyMCE = (function() {
9494

9595
// Ensure save events write back to textarea
9696
config.setup = function(ed) {
97+
ed.on('dirty', function() {
98+
self.save();
99+
});
97100
ed.on('change', function() {
98101
self.save();
99102
});
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
@retry @job2
2+
Feature: Changetracker correctly identifies changes
3+
As a content author
4+
I want to know when unsaved changes have been made
5+
So that I know when I need to save my work
6+
7+
Background:
8+
Given the "Employee" "Employee A" with "Email"="test@example.com" and "Biography"="<p>some content here</p>" and "DateOfBirth"="1990-06-09"
9+
And the "group" "EDITOR" has permissions "Access to 'Test ModelAdmin' section" and "TEST_DATAOBJECT_EDIT"
10+
And I am logged in as a member of "EDITOR" group
11+
And I go to "/admin/test"
12+
And I click "Employees" in the ".ui-tabs-nav" element
13+
And I click "Employee A" in the "#Form_EditForm" element
14+
15+
Scenario: Changing values in TextField
16+
# Should have "tick" icon, not "save" icon (i.e. form is NOT dirty)
17+
Given I should see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
18+
And I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
19+
And I should not see the "form#Form_ItemEditForm.changed" element
20+
When I click on the "input#Form_ItemEditForm_Email" element
21+
And I press the "A" key globally
22+
# Should have "save" icon, not "tick" icon (i.e. form is dirty)
23+
Then I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
24+
And I should see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
25+
And I should see the "form#Form_ItemEditForm.changed" element
26+
# Save so the driver can reset without having to deal with the popup alert.
27+
Then I press the "Save" button
28+
29+
Scenario: Changing values in DateField
30+
# Should have "tick" icon, not "save" icon (i.e. form is NOT dirty)
31+
Given I should see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
32+
And I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
33+
And I should not see the "form#Form_ItemEditForm.changed" element
34+
When I click on the "input#Form_ItemEditForm_DateOfBirth" element
35+
And I press the "8" key globally
36+
# Should have "save" icon, not "tick" icon (i.e. form is dirty)
37+
Then I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
38+
And I should see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
39+
And I should see the "form#Form_ItemEditForm.changed" element
40+
# Save so the driver can reset without having to deal with the popup alert.
41+
Then I press the "Save" button
42+
43+
Scenario: Changing values in DropdownField
44+
# Should have "tick" icon, not "save" icon (i.e. form is NOT dirty)
45+
Given I should see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
46+
And I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
47+
And I should not see the "form#Form_ItemEditForm.changed" element
48+
When I click on the "#Form_ItemEditForm_Category_chosen" element
49+
And I wait 1 second
50+
And I click "hr" in the "#Form_ItemEditForm_Category_chosen .chosen-results" element
51+
# Should have "save" icon, not "tick" icon (i.e. form is dirty)
52+
Then I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
53+
And I should see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
54+
And I should see the "form#Form_ItemEditForm.changed" element
55+
# Save so the driver can reset without having to deal with the popup alert.
56+
Then I press the "Save" button
57+
58+
Scenario: Changing values in HTMLEditorField
59+
# Should have "tick" icon, not "save" icon (i.e. form is NOT dirty)
60+
Given I should see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
61+
And I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
62+
And I should not see the "form#Form_ItemEditForm.changed" element
63+
When I click on the "iframe#Form_ItemEditForm_Biography_ifr" element
64+
And I press the "A" key globally
65+
# Should have "save" icon, not "tick" icon (i.e. form is dirty)
66+
Then I should not see the "button#Form_ItemEditForm_action_doSave.font-icon-tick" element
67+
And I should see the "button#Form_ItemEditForm_action_doSave.font-icon-save" element
68+
And I should see the "form#Form_ItemEditForm.changed" element
69+
# Save so the driver can reset without having to deal with the popup alert.
70+
Then I press the "Save" button

0 commit comments

Comments
 (0)