sizzlemctwizzle / GM_config

A lightweight, reusable, cross-browser graphical settings framework for inclusion in user scripts.

Home Page:https://github.com/sizzlemctwizzle/GM_config/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alert Text in Unit Test

Martii opened this issue · comments

Click once... "This value is not saved"
Close
Click again "null"

Fx/GM... tried before the bulk let operation too. Not sure if it's GMC or the Unit Test.


EDIT: Update... checked all the way back with 45573c4 before everything was done by myself and sizzle and the null is present.

@Martii

Not sure if it's GMC or the Unit Test.

It's GMC. Verified that this bug didn't exist prior to your bulk ES6 migration. I'm against a bulk migration, so I'm reverting to before your changes. I should have made this clear sooner. I will only use ES6 features in new code, while existing code will be left alone. I know this won't be clean or elegant, but it is functional and practical.

Fx/GM... tried before the bulk let operation too.

Just verified this does work correctly in Fx/GM after the reversion. Code that uses var was written with function scope in mind. I don't want to deal with the bugs from the edge cases where let can't be a drop-in replacement for var.

Closing since this isn't an issue with pre-migration GMC.

@sizzlemctwizzle

Yeah you should have definitely made it clearer. It's not elegant at all mixing between these unfortunately and to have the footprint so large which is contrary to the original charter.

Verified that this bug didn't exist prior to your bulk ES6 migration.

...

Closing since this isn't an issue with pre-migration GMC.

If you want a video of the most recent installation a few moments ago I can redo it... but here's a screenshot. i.e. still not anything related to the ES migration.

where let can't be a drop-in replacement for var.

I didn't do a direct drop in I examined each logic path. To assume this is also an error. If you don't value my work you won't get it anymore especially since I feel you didn't even try to check this out. I had the error before the 2 hours I spent converting the appropriate var's to let's.

Still an issue


Confirmed also error present in VM and TM via Chromium.

@sizzlemctwizzle

Here's your video.

The.Error.mp4

@Martii

It's not elegant at all mixing between these unfortunately to have the footprint so large which is contrary to the original charter.

You're right. Keeping it two different ways is a mess. I should have given this more thought regarding the impact on the overall codebase. I'm reverting my reversion (6ab4d25).

I didn't do a direct drop in I examined each logic path. To assume this is also an error.

I figured you did this, but things get a bit wonky in some areas. I should have just trusted that you did your due diligence. Sorry.

If you don't value my work you won't get it anymore

Not at all. Your work is always top notch. I appreciate all that you do.

especially since I feel you didn't even try to check this out.

You're right. I just saw you were doing something that I had previously decided shouldn't be done. I never tested it. That's my mistake.

still not anything related to the ES migration.

Confirmed also error present in VM and TM via Chromium.

I'm still unable to reproduce what you experience in the image or video and have no idea what is going on, so definitely re-opening this issue.

I am seriously sorry with the way I handled this. I should have been much more open-minded and thoughtful. I'll keep this in mind going forward. Please try to forgive me and continue to contribute.

Okay, I was finally able to reproduce. I must have been doing something wrong yesterday. I found that this change to the unit test fixes things:

    'alertTextField': {
        'label': 'Alert Text',
        'type': 'button',
        'click': function() {
            alert(GM_config.get('labelLess', true));
            GM_config.set('labelLess', 'Value changed.');
        }
    },

I still don't know why this works since it should do the same thing.

Edit: Have to use GM_config.get('labelLess', true) to get frame value.

get fails silently when field.toValue() returns null.

let field = this.fields[name],
          fieldVal = null;

      if (getLive && field.node) {
        fieldVal = field.toValue();
      }

      return fieldVal != null ? fieldVal : field.value;

So this explains the discrepancy. This code needs to be fixed as well, but it isn't the source of the bug.

@sizzlemctwizzle

When you get a free serene moment please review both PR's. We seem to have come to a similar conclusion. ;)


Btw this issue is probably the first time I've ever tapped that button more than once in an open frame session... so I never saw this behavior before opening the issue.

Re: #122 (comment)

            alert(GM_config.get('labelLess', true));
            GM_config.set('labelLess', 'Value changed.');

... also works here but I will leave it up to you how to change the Unit Test for sure. Your verbiage seems to be resetting something but my verbiage is what has been currently happening even prior to all of our changes in the last few weeks. (see my oldest commit reference retest above)