GithubHelp home page GithubHelp logo

tldraw / core Goto Github PK

View Code? Open in Web Editor NEW
417.0 5.0 20.0 795 KB

Renderer for tldraw and maybe you, too.

Home Page: https://tldraw-core-example.vercel.app/

canvas react typescript zoom pan pinch whiteboard draw

core's Introduction

@tldraw/core

This package has moved to the tldraw/tldraw monorepo.

core's People

Contributors

fson avatar proful avatar steveruizok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

core's Issues

Testing Approach

Need some of your thoughts on how you want to approach writing tests.

  • Only render component test is fine or
  • Looking for some detailed unit tests validating attributes
    There are multiple point of view.

Example

describe('binding', () => {
  test('mounts component without crashing', () => {
    render(<Binding point={[0, 0]} type={'anchor'} />)
  })
  test('validate attributes rendered properly for anchor binding type', () => {
    const { container } = render(<Binding point={[10, 20]} type={'anchor'} />)
    const use = container.querySelector('use')
    expect(use?.getAttribute('href')).toBe('#cross')
    expect(use?.getAttribute('x')).toBe('10')
    expect(use?.getAttribute('y')).toBe('20')
  })
}

container & dom query selection is not regarded as best practice in RTL. Only benefit to this approach, there is no need to change Binding component src code.

You can suggest which query selector you prefer. Based on that we may need to update actual component.

Created few simple test locally, not able to push to core remote branch. Initially planning to write small tests & small commit to get your review comments, so that I can align to your coding styles & approaches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.