Skip to content

Commit

Permalink
Reactive values and Github actions (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjick authored Apr 8, 2020
1 parent 2e096d7 commit 4bc586e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Tests
on: [push]
jobs:
tests:
name: 'Main'
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 10
- run: yarn install
- run: yarn test
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# react-doc-title

[![NPM](https://img.shields.io/npm/v/react-doc-title.svg)](https://www.npmjs.com/package/@benjick/react-doc-title) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Build Status](https://travis-ci.org/benjick/react-doc-title.svg?branch=master)](https://travis-ci.org/benjick/react-doc-title)
[![NPM](https://img.shields.io/npm/v/react-doc-title.svg)](https://www.npmjs.com/package/@benjick/react-doc-title) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) ![Build Status](https://github.com/benjick/react-doc-title/workflows/Tests/badge.svg)

## Install

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-doc-title",
"version": "1.0.0",
"version": "2.0.0",
"description": "",
"author": "benjick",
"license": "MIT",
Expand Down Expand Up @@ -59,7 +59,7 @@
"dist"
],
"dependencies": {
"constate": "^1.0.0",
"uniqid": "^5.0.3"
"constate": "^2.0.0",
"uniqid": "^5.2.0"
}
}
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Provider, Context} from './useTitles'

export function useTitle(string) {
const context = useContext(Context)
useEffect(() => context.register({string}), [])
useEffect(() => context.register({string}), [string])
}

export function Title({string}) {
Expand Down
6 changes: 3 additions & 3 deletions src/useTitles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function TestComponent() {
<div>
<Provider title='react-doc-title'>
<Title string='test' />
<Title string='test2' />
<Title string={show ? 'test2-show' : 'test2'} />
<button id='toggle' type='button' onClick={toggleShow}>Toggle</button>
<button id='provider' type='button' onClick={toggleProvider}>Toggle</button>
{show && <MyComponent />}
Expand Down Expand Up @@ -77,11 +77,11 @@ it('can change title', () => {
})
const toggle = container.querySelector('button#toggle')
const toggleP = container.querySelector('button#provider')
expect(document.title).toBe('test3 - test2 - test - react-doc-title')
expect(document.title).toBe('test3 - test2-show - test - react-doc-title')
act(() => { toggle.dispatchEvent(click) })
expect(document.title).toBe('test2 - test - react-doc-title')
act(() => { toggle.dispatchEvent(click) })
expect(document.title).toBe('test3 - test2 - test - react-doc-title')
expect(document.title).toBe('test3 - test2-show - test - react-doc-title')
act(() => { toggleP.dispatchEvent(click) })
expect(document.title).toBe('Hooks are cool')
})
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3136,10 +3136,10 @@ constants-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75"
integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=

constate@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/constate/-/constate-1.0.0.tgz#93fa87108e364a05e93b3597e22d53adaf86776d"
integrity sha512-b1Pip712fAQ1el4pndiYeVMXAzlbrD8+Z8ik79TOQc3ZJNjxKGawT0gCPpANsNbT4eHszDZ/8472hvL1rowUhQ==
constate@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/constate/-/constate-2.0.0.tgz#ba9bf91217c306292c1f8a7e45e0ff5a76c38a55"
integrity sha512-oYpbnxDH1BSZTyBHGpSabuT0h/rLU7UDTC8p8J/TLt8G69ePIHCaNyDCz+LUl1QJpCrzrk0jO4D524rJlh4edg==

contains-path@^0.1.0:
version "0.1.0"
Expand Down Expand Up @@ -10888,10 +10888,10 @@ uniq@^1.0.1:
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=

uniqid@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/uniqid/-/uniqid-5.0.3.tgz#917968310edc868d50df6c44f783f32c7d80fac1"
integrity sha512-R2qx3X/LYWSdGRaluio4dYrPXAJACTqyUjuyXHoJLBUOIfmMcnYOyY2d6Y4clZcIz5lK6ZaI0Zzmm0cPfsIqzQ==
uniqid@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/uniqid/-/uniqid-5.2.0.tgz#0d0589a7e9ce07116848126764fbff0b68e74329"
integrity sha512-LH8zsvwJ/GL6YtNfSOmMCrI9piraAUjBfw2MCvleNE6a4pVKJwXjG2+HWhkVeFcSg+nmaPKbMrMOoxwQluZ1Mg==

uniqs@^2.0.0:
version "2.0.0"
Expand Down

0 comments on commit 4bc586e

Please sign in to comment.