Skip to content

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

Closed

Description

@catmando
  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

Activity

  1. catmando commented on Nov 15, 2018

    @catmando
    ContributorAuthor

    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.

  2. added this to the alpha1.3 milestone on Dec 7, 2018
  3. added a commit that references this issue on Jan 15, 2019
  4. added
    ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch
    on Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions