Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange issue with Unit Test #118

Closed
Martii opened this issue May 22, 2023 · 2 comments
Closed

Strange issue with Unit Test #118

Martii opened this issue May 22, 2023 · 2 comments
Labels
Cause Identified root cause has been identified Fixed bug has been fixed

Comments

@Martii
Copy link
Collaborator

Martii commented May 22, 2023

@sizzlemctwizzle

Hmmm...

Somewhere between 0f041ec and 136d28c the CSS on the Unit Test seems to have messed up. The form is all over the place. When I do the raw on 0f041e it's fine... but when I do your merge commit at 136d28 it messes up on page refresh.


OUJS-1 seems unaffected btw.

@Martii
Copy link
Collaborator Author

Martii commented May 22, 2023

Here's the OUJS diff between these two consecutive commits (manual check for GH integrity):

--- /libs/Marti/GM_config_(test)/source@ 010d533
    /libs/Marti/GM_config_(test)/source
@@ -165,12  165,34 @@
 
         for (let id in fields) {
           var field = fields[id];
           var fieldExists = false;
 
           if (config.fields[id]) {
             fieldExists = true;
           }
 
           // for each field definition create a field object
-          if (field)
           if (field) {
             if (config.isOpen && fieldExists) {
                 config.fields[id].remove();
             }
 
             config.fields[id] = new GM_configField(field, stored[id], id,
               customTypes[field.type], configId);
-          else if (config.fields[id]) delete config.fields[id];
 
             // Add field to open frame
             if (config.isOpen) {
               config.fields[id].wrapper = config.fields[id].toNode();
               config.frameSection.appendChild(config.fields[id].wrapper);
             }
           } else if (!field && fieldExists) {
             // Remove field from open frame
             if (config.isOpen) {
               config.fields[id].remove();
             }
 
             delete config.fields[id];
           }
         }
 
         config.isInit = true;
@@ -227,9  249,13 @@
           className: 'config_header block center'
         }, config.title));
 
         var secNum = 0; // Section count
         // Append elements
-        var section = bodyWrapper,
-            secNum = 0; // Section count
         var section = bodyWrapper.appendChild(create('div', {
           className: 'section_header_holder',
           id: configId   '_section_'   (  secNum)
         }));
         
 
         // loop through fields
         for (let id in fields) {
@@ -262,6  288,8 @@
           // Create field elements and append to current section
           section.appendChild((field.wrapper = field.toNode()));
         }
         
         config.frameSection = section;
 
         // Add save and close buttons
         bodyWrapper.appendChild(create('div',
@@ -521,6  549,7 @@
       : (name, value) => localStorage.setItem(name, value);
     let log = typeof GM_log !== 'undefined' ? GM_log : console.log;
 
     var GM = Object.create(null);
     GM.getValue = promisify(getValue);
     GM.setValue = promisify(setValue);
     GM.log = promisify(log);
@@ -530,7  559,7 @@
   construct.prototype.parser = JSON.parse;
   construct.prototype.getValue = GM.getValue;
   construct.prototype.setValue = GM.setValue;
-  construct.prototype.log = GM.log || console.log;
   construct.prototype.log = GM.log;
 
   // Passthrough frontends for new and old usage
   let config = function () {
@@ -870,4  899,4 @@
     }
     return true;
   }
-};
 };
\ No newline at end of file

and GH's:

0f041ec...136d28c

@sizzlemctwizzle
Copy link
Owner

sizzlemctwizzle commented May 22, 2023

This is likely caused by ab5451f. Although I'm not sure how I messed this up. Figured out a solution: only create a default section if no section is created.

@Martii Martii added Cause Identified root cause has been identified Fixed bug has been fixed and removed Feedback Needed waiting on feedback labels May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cause Identified root cause has been identified Fixed bug has been fixed
Projects
None yet
Development

No branches or pull requests

2 participants