WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#47830 new defect (bug)

Something prevents code edition of the theme through HTML on the theme editor for test automation purposes

Reported by: xhat Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 5.2.2
Component: Editor Keywords:
Focuses: Cc:
PR Number:

Description

This should be considered as a bug, because it's preventing code edition straight from the HTML source code of the page hence preventing test automation from working.

I'm using Selenium with the Chrome webdriver for test automation purposes.

This is a stock WordPress install with the default nineteen theme activated, with no plugins.

The URL on which the problem is occurring is
/wp-admin/theme-editor.php

The fields are properly changed, whether it is the textarea id="newcontent" or the code mirror wrapper, but upon clicking on the save button the changes are reverted back BEFORE the Ajax request is sent to make the modifications, hence preventing any sort of modifications when it's made through HTML.

To reproduce the error.

[Optional] Use Google Chrome if possible

  1. Go to /wp-admin/theme-editor.php
  2. Make sure the style.css is loaded
  3. Inspect element and find the textarea id="newcontent"
  4. Remove a whole line
  5. Save
  6. Look at the textarea and see that the changes were reverted back

You can see that the changes are reverted back before the submit button callback is called by placing a JS breakpoint at b.submit inside the file theme-plugin-editor.min.js

Sadly I'm not experienced when it comes to Javascript at all so I just can't get further than that.

Hope someone can get through this bug as our tool depends on this!

Change History (1)

#1 @xhat
2 months ago

I forgot.

Between the 3. and 4. do the following:
Remove the style="display:none;" of the textarea tag

So that you can see visually the changes were reverted back.

Note: See TracTickets for help on using tickets.