Exemplo n.º 1
0
    it("Calls #changeArticle with key/val pair", () => {
      changeArticleData("title", "Title")(dispatch, getState)

      expect(dispatch).toBeCalledWith({
        type: "CHANGE_ARTICLE",
        payload: { data: { title: "Title" } },
      })
    })
Exemplo n.º 2
0
    it("Can accept a key/value pair with nested object as args", () => {
      changeArticleData("series.description", "Series Description")(
        dispatch,
        getState
      )

      expect(dispatch).toBeCalledWith({
        type: "CHANGE_ARTICLE",
        payload: { data: { series: { description: "Series Description" } } },
      })
    })
Exemplo n.º 3
0
  return (dispatch, getState) => {
    const {
      edit: { article },
    } = getState()
    const hero_section = clone(article.hero_section) || {}

    hero_section[key] = value
    dispatch(changeArticleData("hero_section", hero_section))

    if (!article.published) {
      debouncedSaveDispatch(dispatch)
    }
  }
Exemplo n.º 4
0
    it("Can accept an object as args", () => {
      const data = {
        title: "Title",
        series: { description: "Series Description" },
      }
      changeArticleData(data)(dispatch, getState)

      expect(dispatch).toBeCalledWith({
        type: "CHANGE_ARTICLE",
        payload: {
          data: {
            title: "Title",
            series: { description: "Series Description" },
          },
        },
      })
    })
Exemplo n.º 5
0
 return (dispatch, _getState) => {
   dispatch(changeArticleData("hero_section", section))
 }