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

using built in event names in components does not work with triggers macro #59

Closed
catmando opened this issue Nov 15, 2018 · 1 comment
Closed
Labels
bug Something isn't working ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone

Comments

@catmando
Copy link
Contributor

  it "can work with builtin events" do
    mount 'Test' do
      class Btn < HyperComponent
        triggers :click
        Btn.class.attr_accessor :clicked
        render do
          BUTTON(id: :btn) do
            children.each(&:render)
          end.on(:click) do |evt|
            Btn.clicked = true
            click!
            evt.stop_propagation
          end
        end
      end
      class Test < HyperComponent
        render do
          Btn { "CLICK ME" }.on(:click) { toggle(:clicked) } unless @clicked
        end
      end
    end
    expect(page).to have_content('CLICK ME')
    expect_evaluate_ruby('Btn.clicked').to be_falsy
    find('#btn').click
    expect(page).not_to have_content('CLICK ME')
    expect_evaluate_ruby('Btn.clicked').to be_truthy
  end

fails

@catmando
Copy link
Contributor Author

problem is that events are snake cased inside of hyperloop, and camelcased in react. Normally the snake gets translated to the camel, but for some reason this is bypassed for native events. Will dig into it more.

@catmando catmando added the bug Something isn't working label Nov 15, 2018
@catmando catmando added this to the alpha1.3 milestone Dec 7, 2018
catmando added a commit that referenced this issue Jan 15, 2019
@catmando catmando added the ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch label Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-to-release Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Projects
None yet
Development

No branches or pull requests

1 participant