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

fix: use Rich Text field type for Rich Text and Title field values #12

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

angeloashmore
Copy link
Member

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR fixes a bug where Rich Text field values were typed as Title fields. The issue only occurs when a high-level value is generated, like a document or Group field value.

import { createMockFactory } from "@prismicio/mock";

const mock = createMockFactory({ seed: "foo" });

const model = mock.model.customType({
  fields: {
    richText: mock.model.richText(),
  },
});

const value = mock.value.document({ model });

Before this PR, value.data.richText would be typed as TitleField.

After this PR, value.data.title is typed as RichTextField.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

@codecov-commenter
Copy link

Codecov Report

Merging #12 (82f64fd) into main (c0fdbb2) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #12   +/-   ##
=======================================
  Coverage   81.48%   81.48%           
=======================================
  Files          81       81           
  Lines        1037     1037           
  Branches      233      233           
=======================================
  Hits          845      845           
  Misses        130      130           
  Partials       62       62           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0fdbb2...82f64fd. Read the comment docs.

@github-actions
Copy link

size-limit report 📦

Path Size
dist/index.js 15.61 KB (0%)
dist/index.cjs 16.81 KB (0%)

@angeloashmore angeloashmore merged commit c13751c into main Jul 26, 2022
@angeloashmore angeloashmore deleted the aa/fix-rich-text-priority branch July 26, 2022 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants