krakenjs / belter Goto Github PK
View Code? Open in Web Editor NEWMiscellaneous browser utilities
License: Apache License 2.0
Miscellaneous browser utilities
License: Apache License 2.0
The versions for some dependencies are currently outdated.
User agent for Yandex Chromium Browser is being recognized as a Safari browser.
Mozilla/5.0 (iPad; CPU OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 YaBrowser/21.11.1.882.11 Mobile/15E148 Safari/604.1
Need to add an isYandex
and check that it doesn't exist in isSafari
check.
This project isn't written in TypeScript, but many TypeScript users would like to use published typings. For this issue, create TypeScript typings that cover the exported functions, and contribute it back to DefinitelyTyped!
This issue is great for someone who wants to learn more about TypeScript!
Does any line of code require mocking in order to be tested? If so, then Chai, Sinon, and Sinon-chai
should be installed as dependencies, or else karma-sinon-chai
won't be providing any use.
I see here that this is the commit in which chai, sinon, and sinon-chai
were replaced with grumbler-scripts
.
You can see here that grumbler-scripts
does not have chai
, sinon
, nor sinon-chai
as dependencies. Instead, it has karma-sinon-chai
It seems to me that this repo is being functionally tested
rather than unit tested
, so I'm not sure sinon
and chai
are needed at all. Is that why they were removed in the first place? Some one please confirm!
The onResize
method in dom.js
currently uses offsetWidth
and offsetHeight
to get the elements dimensions.
These two attributes always return integer values--disregarding the fractional part
As some elements can have subpixel values, perhaps its worth it considering not to round the width and height to achieve a better precision.
I believe this is also causing the zoid library to sometimes generate slightly wrong iframe sizes, since the method seems to be used here
In case you are interested, I opened a draft PR with a suggested approach:
The function checks if the document body is present. If the document is not ready, it waits for the window to be ready and checks again if the document body is present. If the body is present, it returns the body. If not throws an error. This is the code:
return waitForDocumentReady().then(() => {
if (document.body) {
return document.body;
}
throw new Error('Document ready but document.body not present');
});
But, waitForDocumentReady
calls isDocumentReady
which in turn checks:
if (document.body && document.readyState === 'complete
) return true`
That means the document cannot be ready without the body being ready. This causes an error while testing, when I mocked document.body = null
. Also leads to throw being unreachable.
When I installed the repo I ran npm i
and npm build
then got a bunch of errors.
After some searching online then I found this:
https://www.npmjs.com/package/karma-chrome-launcher#headless-chromium-with-puppeteer
Usage:
npm i -D puppeteer karma-chrome-launcher
After I ran this command my tests started working. Is this something that should be updated in the README.md?
Are there any other ways the testing structure could improve?
I notice that each folder in the tests
folder has an index.js
file in it. Is there a clean way to make it such that we do not have to use an index.js
file inside every folder of the tests
folder?
Every single time a person adds a new folder inside tests
, there are two index.js
file that has to be updated, and then another to be created. The created index.js
would then have to be updated every time someone makes a new testing file, and also must be created in the new folder
that the person added to tests
.
It would be less confusing if we did not have to use so many index.js
, while still maintaining an organized structure. My preliminary thoughts are to make a single script that replaces the need to make a lot of index.js
files.
There are a LOT of useful utilities in belter, however there aren't any unit tests in this repo! ๐ฌ If anyone's interested in picking this up, can you write unit tests for at least two files in src/? ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.