Comments (4)
Adding that code into the beforeEach of the failing component test fixed it. Thanks
from simple-keyboard.
Hello @digilab2017,
KEYBOARD_DOM_ERROR
means that <div class="simple-keyboard"></div>
was not found in the dom at instantiation.
To make the error go away, simple-keyboard needs to find that element when it's run.
https://github.com/hodgef/simple-keyboard/blob/master/src/lib/components/Keyboard.js#L115
You can have a look at my unit tests here:
https://github.com/hodgef/simple-keyboard/blob/master/src/lib/components/tests/Keyboard.test.js#L15
As you see, testUtil.setDOM();
is being called, which in turn does this:
const div = document.createElement('div');
div.className += divClass || "simple-keyboard";
document.body.appendChild(div);
Angular Note: If you're using ngOnInit
, use ngAfterViewInit
instead, as per the following demo:
https://codesandbox.io/s/github/hodgef/angular-simple-keyboard/tree/master/?module=%2Fsrc%2Fapp%2Fapp.component.ts
Regards,
Francisco Hodge
from simple-keyboard.
Hello,
I'm having the same error, but your fix did not solve my issue. Here is my test repository: https://github.com/andrelutza/keyboard-test
Any ideas what it might be?
Thanks!
from simple-keyboard.
@andrelutza It's an issue with your Jest config
In your jest.config.js, find this:
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
and replace it with this
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "jest-transform-stub",
"\\.(css|less)$": "jest-transform-stub"
},
from simple-keyboard.
Related Issues (20)
- Add icons or images to buttons HOT 1
- your web is not opened HOT 1
- Prevent showing system keyboard on tablets HOT 3
- Support for mouse element HOT 2
- Japanese Flick Input (Mobile) HOT 3
- excludeFromLayout doesnt work HOT 2
- can i use in vue3? HOT 1
- Keyboard button not showing with tailwind HOT 2
- Not responsive on mobile HOT 1
- CSS partialy Apply HOT 1
- BackSpace Issue HOT 1
- need more layers (right alt) HOT 2
- Button Hold : Allow additional keys via options HOT 6
- `layoutCandidates` is not case sensitive HOT 1
- When simple-keyboard is used with accessibility voice over turned on, hitting q enters 1 in input HOT 1
- Simple-keyboard Not Rendering HOT 2
- When set layoutCandidatesPageSize = 15, There is an issue with the background color of the candidate box
- Not displaying keyboard outside app.component HOT 1
- Virtual Keyboard, keys are coming all white HOT 1
- Can this component be dragged by the mouse motor? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple-keyboard.