UNPKG

@vergiss/chooks

Version:
27 lines (23 loc) 795 B
"use strict"; import "core-js/modules/es.object.define-property"; Object.defineProperty(exports, "__esModule", { value: true }); var react_hooks_1 = require("@testing-library/react-hooks"); var index_1 = require("../index"); describe('usePageTitle', function () { it('should be defined', function () { expect(index_1.usePageTitle).toBeDefined(); }); it("should change document's title and restore while unmounting", function () { global.window.document.title = 'Hello'; var hook = react_hooks_1.renderHook(function () { return index_1.usePageTitle('Hello World'); }); expect(global.window.document.title).toBe('Hello World'); react_hooks_1.act(function () { hook.unmount(); }); expect(global.window.document.title).toBe('Hello'); }); });