crossing icon indicating copy to clipboard operation
crossing copied to clipboard

Wrong detection of param's name with an overrided param format

Open flepretre opened this issue 10 years ago • 0 comments

When using crossing with the regex new RegExp(':([a-zA-Z0-9-_%]{1,})', 'g'), param last letter aren't return.

Unitary tests doesn't verify kwargs when testing the resolve methode. I improved this test case to reproduce the bug :

    it("can resolve urls with parameters", function () {
      urls.load(reactRouterPaths);
      var resolved = urls.resolve('loop/23/discussion-name/');
      expect(resolved.name).to.equal('discussion:detail');
      expect(Object.keys(resolved.kwargs).length).to.equal(3);
      expect(resolved.kwargs.team_slug).to.equal('loop');
      expect(resolved.kwargs.discussion_id).to.equal('23');
      expect(resolved.kwargs.slug).to.equal('discussion-name');
    });

This is what kwargs contains :

{ team_slu: 'loop', discussion_i: '23', slu: 'discussion-name' }

flepretre avatar Mar 02 '16 13:03 flepretre