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

likely.initiate() doesn’t respect the updated block options #90

Closed
iamakulov opened this issue Aug 26, 2016 · 4 comments
Closed

likely.initiate() doesn’t respect the updated block options #90

iamakulov opened this issue Aug 26, 2016 · 4 comments
Labels

Comments

@iamakulov
Copy link
Collaborator

Steps to reproduce:

  1. Open the test page in the browser.
  2. Open Inspector, choose the first .likely block and change the data-url attribute to http://ilyabirman.ru/projects/likely.
  3. Run likely.initiate() in the console.

Expected result:
The first block’s counters are changed (as it now points to the new URL).

Actual result:
The counters don’t change.

Probably related to #75.

@iamakulov iamakulov added the Bug label Aug 26, 2016
@iamakulov
Copy link
Collaborator Author

<link rel="canonical"> changes are also not respected.

@iamakulov iamakulov added this to the 2.2 milestone Sep 4, 2016
@iamakulov
Copy link
Collaborator Author

I want to do this in 2.2. In this release, we make Likely more suitable for single page apps (by bringing the History API support). I think changing the options and then re-initializing is also common in SPAs, so bringing the release for SPAs without fixing this would be weird.

@iamakulov
Copy link
Collaborator Author

The PR for this should also add the UI tests. I expect something like this:

describe('changing configuration after being loaded', function () {
    beforeEach(function () {
        // The browser could start long
        this.timeout(20000);

        return getLikely(driver, 'http://ilyabirman.github.io/Likely/autoinit.html', { waitUntilInitialized: true })
    });

    it('should change the shared URL when `<link rel="canonical">` is specified', function () {
        return driver.executeScript(`
            document.head.innerHTML += '<link rel="canonical" href="https://google.com">';
            likely.initiate();
        `)
        .then(function () {
            return expectClickToOpen(driver, '.likely__widget_twitter', /twitter\.com\/.*google\.com/)
        });
    });

    // ...
});

(The test infrastructure is currently being developed in #73.)

@iamakulov
Copy link
Collaborator Author

Seems to be caused by

    url: utils.getDefaultUrl(),

in history.js:19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant