This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let db: any | |
export const checkIndexDbBrowserSupport = (): boolean => { | |
return 'indexedDB' in window | |
} | |
export const initialiseDb = (data: any, key: string[]) => { | |
const request = indexedDB.open('mtd', 1) | |
return new Promise((resolve, reject) => { | |
request.onupgradeneeded = (e: any) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const exampleData = [ | |
{data: [{categoryName: 'To do', listName: 'Personal'}, | |
{categoryName: 'To do', listName: 'Work'}]}, | |
{data: [{listName: 'Personal'}, {listName: 'Work'}]} | |
] | |
const key = ['category', 'list'] | |
let db | |
let request = indexedDB.open('mtd', 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get JSON from local storage with key mtdListData | |
const listData = JSON.parse(localStorage.getItem('mtdListData') | |
// Inserting listData into LocalStorage. | |
localStorage.mtdListData = JSON.stringify(listData) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FormEventHandler from '../FormEventHandler'; | |
describe('FormEventHandler.spec.ts', () => { | |
beforeEach(() => { | |
const fixture = `<form id="fixture"> | |
<div role="radiogroup"> | |
<h3>Radio buttons</h3> | |
<div role="radio" class="radio-input-ac" | |
value="option1" id="option1"> | |
Option 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FormEventHandler from '../FormEventHandler'; | |
describe('FormEventHandler.spec.ts', () => { | |
beforeEach(() => { | |
const fixture = `<form id="fixture"> | |
<div role="radiogroup"> | |
<h3>Radio buttons</h3> | |
<div role="radio" class="radio-input-ac" | |
value="option1" id="option1"> | |
Option 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormEventHandler implements IEventHandler { | |
private formElement: HTMLElement; | |
constructor(formElement: HTMLElement) { | |
this.formElement = formElement; | |
} | |
public init(): void { | |
this.radioInputHandler(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SelectEventHandler from '../SelectEventHandler'; | |
describe('SelectEventHandler.spec.ts', () => { | |
beforeEach(() => { | |
const fixture = `<div id="fixture"> | |
<form id="mock-form"> | |
<select id="first-select"> | |
<option value="" class="default">Select option</option> | |
<option value="Dr" class="option">Dr</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IEventHandler } from './types/interfaces'; | |
class SelectEventHandler implements IEventHandler { | |
private formElement: HTMLElement; | |
private selectElements: any; | |
constructor(formElement: HTMLElement) { | |
this.formElement = formElement; | |
this.selectElements = this.formElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- aria-checked is not required --> | |
<input type="radio" | |
class="radio-input" | |
id="adelaide" | |
name="venue" | |
value="adelaide" | |
aria-checked="false" /> | |
<!-- remove aria-checked --> | |
<input type="radio" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset class="input-field" tabindex=0> | |
<legend class="checkbox-title"> | |
Subscribe to our news letter | |
</legend> | |
<div class="checkbox-group"> | |
<input type="checkbox" class="checkbox-input" | |
id="subscribe" name="subscribe" tabindex=0/> | |
<label class="radio-label" for="subscribe"> | |
Subscribe | |
</label> |