profile
viewpoint

pull request commentairbnb/MvRx

Remove Kotlin-Reflect entirely

This is amazing @gpeal ! Thanks! We are just starting to use MvRx, and so far it's been great. Waiting on this change to get released before we can merge and push out in a release though. Any idea on the timeline for this getting merged and released?

gpeal

comment created time in 3 minutes

fork g2google/javascript

JavaScript Style Guide

fork in 9 minutes

startedairbnb/javascript

started time in 9 minutes

Pull request review commentairbnb/MvRx

Remove Kotlin-Reflect entirely

 annotation class PersistState  * Iterates through all member properties annotated with [PersistState] and parcels them into a bundle that can be  * saved with savedInstanceState.  */-internal fun <T : Any> T.persistState(assertCollectionPersistability: Boolean = false): Bundle {-    val klass = this::class-    val persistStateArgs = klass.primaryConstructor-            ?.parameters-            ?.filter { it.annotations.any { it.annotationClass == PersistState::class } }-    if (persistStateArgs?.isEmpty() != false) {-        return Bundle()-    }+internal fun <T : MvRxState> T.persistState(validation: Boolean = false): Bundle {+    val jvmClass = this::class.java+    // Find the first constructor that has parameters annotated with @PersistState or return.+    val constructor = jvmClass.constructors.firstOrNull { it.parameterAnnotations.any { it.any { it is PersistState } } } ?: return Bundle()++    val bundle = Bundle()+    constructor.parameterAnnotations.forEachIndexed { i, p ->+        if (p.none { it is PersistState }) return@forEachIndexed+        // For each parameter in the constructor, there is a componentN function becasuse state is a data class.+        // We can rely on this to be true because the MvRxMutabilityHelpers asserts that the state class is a data class.+        val getter = try {+            jvmClass.getDeclaredMethod("component${i + 1}").also { it.isAccessible = true }+        } catch (e: NoSuchMethodException) {+            if (validation) throw e

Wouldn't most people turn off validation in production? And since a lot of people proguard in production, if in the future the proguard rule breaks it seems dangerous to only throw this with validation (or for people that never use validation)

Is there a situation where we ever expect this to have an error.

gpeal

comment created time in an hour

created tagairbnb/MagazineLayout

tagv1.5.4

A collection view layout capable of laying out views in vertically scrolling grids and lists.

created time in an hour

delete branch airbnb/MagazineLayout

delete branch : bk/fix-pinned-headers-refresh-control

delete time in an hour

push eventairbnb/MagazineLayout

Bryan Keller

commit sha 94bdfa8d3b772b194a822ed12b996c346a1c4042

Bk/fix pinned headers refresh control (#65) * Fix pinned header refresh control offset * Add clarrifying code comment

view details

push time in an hour

PR merged airbnb/MagazineLayout

Bk/fix pinned headers refresh control bug

Details

This is an alternate solution to https://github.com/airbnb/MagazineLayout/pull/62, which is a fix for https://github.com/airbnb/MagazineLayout/issues/61

From the original PR:

While the collectionView is refreshing, if someone were to scroll down the sticky header's positioning is not adjusted properly. This fix updates the header frame, accounting for the refresh control height when the user is scrolling down.

Related Issue

https://github.com/airbnb/MagazineLayout/issues/61

Motivation and Context

If we don't introduce this code, then pinned headers with a refresh control look incorrect.

Before After
69503386-33f2b600-0ee7-11ea-96f9-74d377c71182 ezgif com-video-to-gif-4

How Has This Been Tested

Tested in sample app.

Types of changes

<!--- What types of changes does your code introduce? Put an x in all the boxes that apply: -->

  • [ ] Docs change / refactoring / dependency upgrade
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

<!--- Go over all the following points, and put an x in all the boxes that apply. --> <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
+17 -5

0 comment

3 changed files

bryankeller

pr closed time in an hour

issue closedairbnb/enzyme

adapter-react-16 v1.15.2 causes find() method to return unexpected number of nodes

Current behavior

After updating to version 1.5.2 of enzyme-adapter-react-16 a few our unit tests have started failing with errors like Method “props” is meant to be run on 1 node. 2 found instead. An investigation has revealed that shallow API find method now picks up extra nodes which it actually shouldn't. Further investigation has shown that the issue happens only with components which are both styled and memoized and A React Component Constructor type of selector is used. The following test suite demonstrates the issue:

import { shallow } from 'enzyme'
import React from 'react'
import styled from 'styled-components'

const Button = ({ children }) => <button>{children}</button>
const MemoedButton = React.memo(Button)

const TestBlock = ({ children }) => (
  <div>
    {children}
    <p>some text</p>
  </div>
)

describe('find a component by its React constructor', () => {
  it('should return a single styled memoed component but fails to do that', () => {
    const PrimaryMemoButton = styled(MemoedButton)`color: red;`
    const wrapper = shallow(<TestBlock><PrimaryMemoButton>Ok</PrimaryMemoButton></TestBlock>)

    expect(wrapper.find(PrimaryMemoButton)).toHaveLength(1) // 3 nodes were found

    // console.log(wrapper.find(PrimaryMemoButton).debug()) outputs:
    //
    // <Styled(Component)>
    // Ok
    // </Styled(Component)>
    //
    //
    // Ok
    //
    //
    // some text
  })

  it('should return a single memoed component', () => {
    const wrapper = shallow(<TestBlock><MemoedButton>Ok</MemoedButton></TestBlock>)

    expect(wrapper.find(MemoedButton)).toHaveLength(1)
  })

  it('should return a single styled component', () => {
    const PrimaryButton = styled(Button)`color: blue;`
    const wrapper = shallow(<TestBlock><PrimaryButton>Ok</PrimaryButton></TestBlock>)

    expect(wrapper.find(PrimaryButton)).toHaveLength(1)
  })
})

The first test fails with:

● find a component by reference › should return a single styled memoed component but fails to do that

    expect(received).toHaveLength(expected)

    Expected length: 1
    Received length: 3
    Received object: {}

      24 |     const wrapper = shallow(<TestBlock><PrimaryMemoButton>Ok</PrimaryMemoButton></TestBlock>)
      25 | 
    > 26 |     expect(wrapper.find(PrimaryMemoButton)).toHaveLength(1)
         |                                             ^
      27 |   })

Version v1.15.1 of the adapter doesn't have such issue.

Expected behavior

find method should return the expected number of nodes (a single node in the example above).

Your environment

styled-components v3.4.10

API

  • [x] shallow
  • [ ] mount
  • [ ] render

Version

library version
enzyme 3.11
react 16.12.0
react-dom 16.12.0
adapter (below) 1.15.2

Adapter

  • [x] enzyme-adapter-react-16
  • [ ] enzyme-adapter-react-16.3
  • [ ] enzyme-adapter-react-16.2
  • [ ] enzyme-adapter-react-16.1
  • [ ] enzyme-adapter-react-15
  • [ ] enzyme-adapter-react-15.4
  • [ ] enzyme-adapter-react-14
  • [ ] enzyme-adapter-react-13
  • [ ] enzyme-adapter-react-helper
  • [ ] others ( )

closed time in an hour

sergey-be

issue commentairbnb/enzyme

adapter-react-16 v1.15.2 causes find() method to return unexpected number of nodes

If it's only broken with styled-components v3, I'm going to assume it's a bug in that package (it wouldn't be the first bug it's caused by doing atypical things with React components).

Happy to reopen if there's outstanding issues.

sergey-be

comment created time in an hour

startedairbnb/polyglot.js

started time in an hour

issue openedairbnb/lottie-web

Performance issue on a large file

Hi,

I have an issue with an animation, the JSON is 6mb and the file takes about 13 sec until the the DOMLoaded event is fired.

any ideas what I can do, its has a lot of elements. https://amazing-panini-f3bf32.netlify.com/

created time in an hour

pull request commentairbnb/rheostat

Implements autoFocus

Also note it would need to be done without hooks and without React.createRef.

cassiozen

comment created time in an hour

created tagairbnb/MagazineLayout

tagv1.5.3

A collection view layout capable of laying out views in vertically scrolling grids and lists.

created time in an hour

push eventairbnb/MagazineLayout

Nathan Sentjens

commit sha 1754be619eadc4152b71c2e9b901e50989c600d9

Mark MagazineLayout target safe for app extensions (#66)

view details

Bryan Keller

commit sha 207f2979e7f5a8e3f730ff98458e9a4ccf03fbe8

Fix pinned header refresh control offset

view details

Bryan Keller

commit sha a262d09b8d4864c3c646c0f72790e49476632fe3

Add clarrifying code comment

view details

push time in an hour

pull request commentairbnb/MagazineLayout

Mark MagazineLayout target safe for app extensions

Thanks @nate-sentjens ! I'll push the pod update now 🙂

nate-sentjens

comment created time in 2 hours

push eventairbnb/MagazineLayout

Nathan Sentjens

commit sha 1754be619eadc4152b71c2e9b901e50989c600d9

Mark MagazineLayout target safe for app extensions (#66)

view details

push time in 2 hours

PR merged airbnb/MagazineLayout

Mark MagazineLayout target safe for app extensions enhancement

Details

This PR addresses a linker warning when linking MagazineLayout.framework to a target that sets APPLICATION_EXTENSION_API_ONLY to YES, by marking the setting as YES on this framework as well.

For example, ld: warning: linking against a dylib which is not safe for use in application extensions: [...]/Carthage/Build/iOS/MagazineLayout.framework/MagazineLayout

(Déjà vu!)

How Has This Been Tested

Pointed a local project's Cartfile entry to this branch and verified the absence of the warning.

Types of changes

  • [x] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ ] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
+9 -3

0 comment

2 changed files

nate-sentjens

pr closed time in 2 hours

issue commentairbnb/lottie-web

Could not export files

image

Jazonel

comment created time in 2 hours

issue openedairbnb/lottie-web

Could not export files

<!-- This template is for bug reports. If you are reporting a bug, please answer all the questions below. If you are here for another reason (feature request, question, etc) please delete this template before continuing.

Note that leaving sections blank will make it difficult for us to troubleshoot bugs, causing delays in our response,
or result in closing this issue.

Please include screenshots where applicable.

-->

Im using AE 2019

im trying to export a json file but bodymovin says "Could not export files is Preferences > scripting & Expressiones > Allow Scripts to write files and access Network enabled?" i dont find these preferences to change.

created time in 2 hours

startedairbnb/javascript

started time in 2 hours

startedairbnb/SpinalTap

started time in 2 hours

push eventairbnb/Lona

mathieudutour

commit sha 122226dce845f8207b3ca585f7b75b850ef0fe88

add documentation generation

view details

push time in 2 hours

startedairbnb/javascript

started time in 2 hours

pull request commentairbnb/rheostat

Implements autoFocus

AFAIK ref is the preferred way to deal with imperative APIs in React, but I agree that giving access to the handle's ref might be too much. Maybe exposing a focus method on the Rheostat's ref?

Would look something like this:

const MyComponent = () => {
  const sliderEl = useRef(null);
  useEffect(() => {
      sliderEl.current.focus();
  });
  return <Slider ref={sliderEl} />
}
cassiozen

comment created time in 2 hours

issue commentairbnb/enzyme

.update() does not work when testing .setState within componentDidMount

@ljharb Thanks for the call out, I went back and tweaked my test and verified it works without chaining. I'm not sure what happened the first time I wrote the tests and why it seemed to fix the async issues I was having. I also thought it was strange that it didn't work. I appreciate you monitoring this thread.

I did have to use a setTimeout in conjunction with update() in some tests I wrote yesterday. On submitting the form, the component runs various validations and has two different rounds of setState(). (I know, not ideal)

         const form = mountWithTheme(<FormComponent {...props} />);
         form.find('button[type="submit"]').simulate('click');
         form.update();
         setTimeout(() => {
           expect(form.text()).toContain('Custom Field is required');
         }, 0);
jack-evans

comment created time in 2 hours

startedairbnb/javascript

started time in 2 hours

startedairbnb/javascript

started time in 3 hours

startedairbnb/javascript

started time in 3 hours

startedairbnb/lottie-ios

started time in 3 hours

startedairbnb/MvRx

started time in 3 hours

issue commentairbnb/enzyme

Issue with shallow testing component handling redux hooks

That's not working for me

CYB3RL1F3

comment created time in 3 hours

startedairbnb/lottie-web

started time in 4 hours

startedairbnb/lottie-web

started time in 4 hours

startedairbnb/lottie-web

started time in 4 hours

issue commentairbnb/streamalert

Unstable Terraform configuration, keeps switching between two states.

Temp Solution

As a temp solution, you can change the below to false

https://github.com/airbnb/streamalert/blob/d0e28f330a8636b9e080540ba098500801a857dc/conf/clusters/prod.json#L53

dgrenner

comment created time in 4 hours

startedairbnb/epoxy

started time in 4 hours

issue commentairbnb/enzyme

adapter-react-16 v1.15.2 causes find() method to return unexpected number of nodes

I cannot reproduce the issue after upgrading styled-components to v4.x. The type of the styled component now looks different:

  console.log(wrapper.find(PrimaryMemoButton).map(node => node.type()))
   [
      {
        '$$typeof': Symbol(react.forward_ref),
        render: [Function: forwardRef] { displayName: 'Styled(Component)' },
        displayName: 'Styled(Component)',
        attrs: [],
        componentStyle: ComponentStyle {
          rules: [Array],
          isStatic: false,
          componentId: 'sc-bdVaJa'
        },
        foldedComponentIds: [],
        styledComponentId: 'sc-bdVaJa',
        target: {
          '$$typeof': Symbol(react.memo),
          type: [Function: Button],
          compare: null
        },
        withComponent: [Function: withComponent],
        warnTooManyClasses: [Function],
        toString: [Function],
        compare: null
      }
    ]

I guess what happens in case of styled-components v3 is that the adapter fails to determine the type of a styled and memo'ed component and picks up all nodes with type undefined.

sergey-be

comment created time in 5 hours

issue commentairbnb/streamalert

Unstable Terraform configuration, keeps switching between two states.

this is definitely the issue, across StreamAlert, cloudwatch metric alarms are configured in numerous places but point to the same resources. This should be consolidated into one place. Options:

  1. Only use tf_monitoring to setup all of the metric alarms across the board (this is undesirable as the config files are currently mapped to the modules)

  2. Each resource created such as lambda, kinesis should have their relevant modules create the relevant metric alarms with a boolean option to enable/disable

dgrenner

comment created time in 5 hours

issue commentairbnb/lottie-web

missing text colors after bodymovin export

not sure what you mean, but a workaround is creating every text with a different color in a different text box

bradberry-o

comment created time in 5 hours

issue commentairbnb/enzyme

adapter-react-16 v1.15.2 causes find() method to return unexpected number of nodes

@ljharb here is debugging output for the failed test:

const wrapper = shallow(<TestBlock><PrimaryMemoButton>Ok</PrimaryMemoButton></TestBlock>)

  console.log(wrapper.debug())
    <div>
      <Styled(Component)>
        Ok
      </Styled(Component)>
      <p>
        some text
      </p>
    </div>

  console.log(wrapper.find(PrimaryMemoButton).debug())
    <Styled(Component)>
      Ok
    </Styled(Component)>


    Ok


    some text

  console.log(wrapper.find(PrimaryMemoButton).map(node => node.type()))
    [
      [Function: StyledComponent] {
        withComponent: [Function: withComponent],
        attrs: undefined,
        componentStyle: ComponentStyle {
          rules: [Array],
          isStatic: true,
          componentId: 'sc-bdVaJa'
        },
        contextTypes: {
          '__styled-components__': [Function],
          '__styled-components__next__': [Function],
          '__styled-components-stylesheet__': [Function]
        },
        displayName: 'Styled(Component)',
        styledComponentId: 'sc-bdVaJa',
        target: {
          '$$typeof': Symbol(react.memo),
          type: [Function: Button],
          compare: null
        },
        warnTooManyClasses: [Function],
        '$$typeof': Symbol(react.memo),
        compare: null
      },
      undefined,
      undefined
    ]

Here is the debugging output from the first successful test:

const wrapper = shallow(<TestBlock><MemoedButton>Ok</MemoedButton></TestBlock>)

  console.log(wrapper.debug())
    <div>
      <Memo(Button)>
        Ok
      </Memo(Button)>
      <p>
        some text
      </p>
    </div>

  console.log(wrapper.find(MemoedButton).debug())
    <Memo(Button)>
      Ok
    </Memo(Button)>

  console.log(wrapper.find(MemoedButton).map(node => node.type()))
    [
      {
        '$$typeof': Symbol(react.memo),
        type: [Function: Button],
        compare: null
      }
    ]

and from the second successful one:

const wrapper = shallow(<TestBlock><PrimaryButton>Ok</PrimaryButton></TestBlock>)

  console.log(wrapper.debug())
   <div>
      <Styled(Button)>
        Ok
      </Styled(Button)>
      <p>
        some text
      </p>
    </div>

 console.log(wrapper.find(PrimaryButton).debug())
    <Styled(Button)>
      Ok
    </Styled(Button)>

  console.log(wrapper.find(PrimaryButton).map(node => node.type()))
    [
      [Function: StyledComponent] {
        withComponent: [Function: withComponent],
        attrs: undefined,
        componentStyle: ComponentStyle {
          rules: [Array],
          isStatic: true,
          componentId: 'sc-bwzfXH'
        },
        contextTypes: {
          '__styled-components__': [Function],
          '__styled-components__next__': [Function],
          '__styled-components-stylesheet__': [Function]
        },
        displayName: 'Styled(Button)',
        styledComponentId: 'sc-bwzfXH',
        target: [Function: Button],
        warnTooManyClasses: [Function]
      }
    ]

The behaviour is apparently incorrect as it picks up 2 extra nodes which are just strings. The issue probably lies not in the adapter itself but in one of its dependencies.

sergey-be

comment created time in 5 hours

startedairbnb/swift

started time in 5 hours

issue commentairbnb/lottie-web

missing text colors after bodymovin export

Hmm, I see. Is there a way to get to the preferred export though?

bradberry-o

comment created time in 5 hours

startedairbnb/swift

started time in 5 hours

startedairbnb/javascript

started time in 6 hours

startedairbnb/javascript

started time in 6 hours

startedairbnb/prop-types

started time in 6 hours

issue commentairbnb/lottie-web

missing text colors after bodymovin export

Hi, unfortunately AE doesn't expose per character text information, it only provides color for the full text box. That's why the extension can't identify more than one color

bradberry-o

comment created time in 6 hours

startedairbnb/javascript

started time in 6 hours

push eventairbnb/Lona

mathieudutour

commit sha 1a8e040b56ac1c3bb82dbe94c95a40bfacefe2be

fix token generation

view details

push time in 6 hours

issue openedairbnb/lottie-web

missing text colors after bodymovin export

Hi comm, I'm struggling with a lottie animation I created on AE. The color of the text is missing in the export of Bodymovin, does someone know how to fix this?

AE: unknown Export: unknown

created time in 6 hours

startedairbnb/ruby

started time in 6 hours

issue commentairbnb/lottie-web

Adobe Animate and Bodymovin / Lottie

@shuklaaj @charlesbunny @Jaswant99

Anyone could tell me why does this animation crash Animate CC when publishing to a Lottie JSON?

Lucas_Lottie(Beta).fla.zip

Hi @arturosanz I tried your file. I confirm it crashes also on my machine. Indeed let's wait for the reply from @shuklaaj ant the Adobe team.

riscovo

comment created time in 6 hours

issue commentairbnb/lottie-web

Adobe Animate and Bodymovin / Lottie

Hey everyone, happy 2020!

Any news on the POC?

riscovo

comment created time in 6 hours

issue openedairbnb/lottie-android

Click listener for objects playing in lottie view.

With lottie-web it is possible to add click listener, but how can I achieve the same in android. For eg;

anim.addEventListener('DOMLoaded', function(){

$("#hamburger").on("click", function () {
  anim.playSegments([[0,20]],true);
  $("#bodymovin").css("z-index", "4");
  $("#bodymovin").css("transition", "z-index 0s step-end, opacity 0s linear");
  $("#hamburger").css("display", "none");
  $("#hamburger").css("cursor", "default");
  });
})

created time in 7 hours

issue commentairbnb/streamalert

Unstable Terraform configuration, keeps switching between two states.

Just been digging into this issue, and i believe i have found the root cause. Just going to see if can implement a fix but my belief is that these two modules:

  • terraform/modules/tf_monitoring
  • terraform/modules/tf_lambda

are stepping on each others toes. Here is my potential proof:

https://github.com/airbnb/streamalert/blob/d0e28f330a8636b9e080540ba098500801a857dc/terraform/modules/tf_lambda/cloudwatch.tf#L40-L59

https://github.com/airbnb/streamalert/blob/d0e28f330a8636b9e080540ba098500801a857dc/terraform/modules/tf_monitoring/main.tf#L5-L27

dgrenner

comment created time in 7 hours

startedairbnb/javascript

started time in 7 hours

startedairbnb/css

started time in 7 hours

startedairbnb/javascript

started time in 7 hours

startedairbnb/Lona

started time in 7 hours

startedairbnb/enzyme

started time in 8 hours

issue commentairbnb/lottie-web

When I export my animation nothing is actually exported.

Hi, can you share the .aep? Also, what version of AE and bodymovin are you using?

ChristianWust

comment created time in 8 hours

startedairbnb/Lona

started time in 8 hours

startedairbnb/lottie-web

started time in 8 hours

startedairbnb/knowledge-repo

started time in 8 hours

startedairbnb/react-sketchapp

started time in 9 hours

startedairbnb/lottie

started time in 9 hours

fork wangcheng/react-dates

An easily internationalizable, mobile-friendly datepicker library for the web

http://airbnb.io/react-dates

fork in 9 hours

startedairbnb/lottie-android

started time in 10 hours

startedairbnb/lottie-android

started time in 10 hours

startedairbnb/lottie-android

started time in 10 hours

fork Airforce-1/DeepLinkDispatch

A simple, annotation-based library for making deep link handling better on Android

http://nerds.airbnb.com/deeplinkdispatch/

fork in 10 hours

startedairbnb/lottie-android

started time in 10 hours

pull request commentairbnb/MvRx

Add Jetpack navigation module

Illegal state exception will still be thrown in this approach on configuration changed

marukami

comment created time in 10 hours

startedairbnb/Lona

started time in 10 hours

fork happyDreamTaken/javascript

JavaScript Style Guide

fork in 10 hours

startedairbnb/lottie-android

started time in 10 hours

startedairbnb/javascript

started time in 10 hours

startedairbnb/javascript

started time in 10 hours

startedairbnb/aerosolve

started time in 10 hours

startedairbnb/hypernova

started time in 10 hours

fork yooooy/lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/

fork in 10 hours

startedairbnb/javascript

started time in 10 hours

startedairbnb/javascript

started time in 10 hours

startedairbnb/react-dates

started time in 10 hours

fork anil-kk/javascript

JavaScript Style Guide

fork in 11 hours

issue commentairbnb/lottie-android

Scale best practice

centerCrop only works with width="wrap_content" and height="wrap_content" not with fixed width and height.

lawloretienne

comment created time in 11 hours

startedairbnb/javascript

started time in 11 hours

startedairbnb/lottie-android

started time in 11 hours

fork 532864087/lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native

http://airbnb.io/lottie/

fork in 11 hours

issue commentairbnb/enzyme

jest.fn() value must be a mock function or spy.

React provides no hooks into hooks, so there's no advanced testing tools available for them.

Please file a new issue if you have new questions.

sean-killeen

comment created time in 11 hours

issue commentairbnb/enzyme

jest.fn() value must be a mock function or spy.

Hi @sean-killeen

tree.instance().onBlurItem is an original function of AdvancedItemSelection class which is

onBlurItem(value, excluded = false) {
 if (!value.length) return;
 // call action here
}

and you can not expect toBeCalledWith function as it available with mocked functions only.

In order to test that it was called you need to mock it first. In order to do it you can use spyOn. And your test suite may look like

it("calls onBlur function when textField is blurred ", () => {
  // spy before creating an instance of a class
  const spy = jest.spyOn(AdvancedItemSelection.prototype, "onBlurItem");

  // preconditions 
  // simlute method call
  // assertion 

  // it's important to restore an orginal method as next test suite will use mocked version. 
  spy.mockRestore();
});

Also, I noticed that you simulate change with currentTarget and in your code you use target. So if your input implementation uses target simulate with currentTarget would not help you.

I hope it helps you.

@mykhailo-riabokon what if i have a functional component.. hooks i.e. ?

sean-killeen

comment created time in 11 hours

startedairbnb/lottie-ios

started time in 11 hours

startedairbnb/lottie-ios

started time in 11 hours

issue openedairbnb/lottie-android

3D rotate problem

Read this or your issue will be closed in android 3D Animation not executed 归档.zip

  • Before opening a new issue, look through existing issues for duplicates.
  • Simplify your animation to the simplest animation that reproduces your issue.
  • Zip your After Effects AEP file and attach it. Your issue will be auto-closed if it doesn't have an AEP or no explicit reason otherwise is given.
  • If you don't know English, run your issue through Google Translate.
  • If you leave the template text in your issue, it will be closed.

created time in 12 hours

startedairbnb/lottie-ios

started time in 12 hours

startedairbnb/lottie-android

started time in 12 hours

issue closedairbnb/streamalert

[release-3-0-0] Error when running terraform init

Background

Currently trying to initialize the infrastructure through terraform via ./manage.py init and i am running into the following error

Description

stacktrace: error.txt Copy and paste the error here for the convenience.

Error: Invalid count argument

  on modules/tf_rules_engine/iam.tf line 27, in resource "aws_iam_role_policy" "read_rules_table":
  27:   count  = var.rules_table_arn == "" ? 0 : 1

The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.

[ERROR 2020-01-14 16:25:46,960 (streamalert_cli.helpers:68)]: An error occurred while running: terraform apply -refresh=true -auto-approve=false -target=module.classifier_prod_lambda -target=module.alert_merger_lambda -target=module.alert_processor_lambda -target=module.rules_engine_iam -target=module.streamalert_athena -target=module.classifier_prod_iam -target=module.alert_merger_iam -target=module.alert_processor_iam -target=module.rules_engine_lambda
['terraform', 'apply', '-refresh=true', '-auto-approve=false', '-target=module.classifier_prod_lambda', '-target=module.alert_merger_lambda', '-target=module.alert_processor_lambda', '-target=module.rules_engine_iam', '-target=module.streamalert_athena', '-target=module.classifier_prod_iam', '-target=module.alert_merger_iam', '-target=module.alert_processor_iam', '-target=module.rules_engine_lambda']
Traceback (most recent call last):
  File "./manage.py", line 116, in <module>
    main()
  File "./manage.py", line 112, in main
    sys.exit(not cli_runner(options))
  File "/Users/USER/personal/github/streamalert/streamalert_cli/runner.py", line 70, in cli_runner
    result = cmds[args.command](args)
  File "/Users/USER/personal/github/streamalert/streamalert_cli/runner.py", line 126, in <lambda>
    command: lambda opts, cmd=cli_command: cmd.handler(opts, config)
  File "/Users/USER/personal/github/streamalert/streamalert_cli/terraform/handlers.py", line 116, in handler
    create_table('alerts', alerts_bucket, config)
  File "/Users/USER/personal/github/streamalert/streamalert_cli/athena/handler.py", line 367, in create_table
    if athena_client.check_table_exists(sanitized_table_name):
  File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 310, in check_table_exists
    result = self.run_query_for_results('SHOW TABLES LIKE \'{}\';'.format(table_name))
  File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 285, in run_query_for_results
    execution_id = self._execute_and_wait(query)
  File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 106, in _execute_and_wait
    self.check_query_status(execution_id)
  File "/Users/USER/personal/github/streamalert/streamalert/shared/athena.py", line 218, in check_query_status
    'Query \'{}\' {} with reason \'{}\', exiting'.format(execution_id, state, reason)
streamalert.shared.athena.AthenaQueryExecutionError: Query 'QUERY_ID (scrubbed)' FAILED with reason 'FAILED: SemanticException [Error 10072]: Database does not exist: (removed_prefix_but_that_goes_here)_streamalert', exiting

Steps to Reproduce

  • git clone git@github.com:airbnb/streamalert.git
  • git checkout -b release-3-0-0
  • follow initial setup (venv, prefix, account_id)
  • run ./manage.py init

closed time in 12 hours

jack1902

startedairbnb/react-sketchapp

started time in 12 hours

more