Skip to content

Commit

Permalink
removed legacy test
Browse files Browse the repository at this point in the history
  • Loading branch information
imjordanxd committed Dec 10, 2024
1 parent 461c5e7 commit c4e02b1
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions packages/mobx-react-lite/__tests__/observer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function runTestSuite(mode: "observer" | "useObserver") {
list: 0
}

const TodoItem = obsComponent(({ todo }: { todo: typeof store.todos[0] }) => {
const TodoItem = obsComponent(({ todo }: { todo: (typeof store.todos)[0] }) => {
renderings.item++
return <li>|{todo.title}</li>
}, true)
Expand Down Expand Up @@ -997,38 +997,6 @@ it("dependencies should not become temporarily unobserved", async () => {
expect(doubleDisposed).toBeCalledTimes(1)
})

it("Legacy context support", () => {
const contextKey = "key"
const contextValue = "value"

function ContextConsumer(_, context) {
expect(context[contextKey]).toBe(contextValue)
return null
}

ContextConsumer.contextTypes = {
[contextKey]: () => null
}

const ObserverContextConsumer = observer(ContextConsumer)

class ContextProvider extends React.Component {
getChildContext() {
return { [contextKey]: contextValue }
}

render() {
return <ObserverContextConsumer />
}
}

;(ContextProvider as any).childContextTypes = {
[contextKey]: () => null
}

render(<ContextProvider />)
})

it("Throw when trying to set contextType on observer", () => {
const NamedObserver = observer(function TestCmp() {
return null
Expand Down

0 comments on commit c4e02b1

Please sign in to comment.