fix: enable navigator.setAppBadge/clearAppBadge (#27067)

This commit is contained in:
John Kleinschmidt 2021-01-21 00:45:06 -05:00 committed by GitHub
parent 8b74361b0c
commit c5a41defbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 481 additions and 41 deletions

View file

@ -551,46 +551,42 @@ describe('app module', () => {
const platformIsNotSupported =
(process.platform === 'win32') ||
(process.platform === 'linux' && !app.isUnityRunning());
const platformIsSupported = !platformIsNotSupported;
const expectedBadgeCount = 42;
after(() => { app.badgeCount = 0; });
describe('on supported platform', () => {
it('with properties', () => {
ifdescribe(!platformIsNotSupported)('on supported platform', () => {
describe('with properties', () => {
it('sets a badge count', function () {
if (platformIsNotSupported) return this.skip();
app.badgeCount = expectedBadgeCount;
expect(app.badgeCount).to.equal(expectedBadgeCount);
});
});
it('with functions', () => {
it('sets a badge count', function () {
if (platformIsNotSupported) return this.skip();
describe('with functions', () => {
it('sets a numerical badge count', function () {
app.setBadgeCount(expectedBadgeCount);
expect(app.getBadgeCount()).to.equal(expectedBadgeCount);
});
it('sets an non numeric (dot) badge count', function () {
app.setBadgeCount();
// Badge count should be zero when non numeric (dot) is requested
expect(app.getBadgeCount()).to.equal(0);
});
});
});
describe('on unsupported platform', () => {
it('with properties', () => {
ifdescribe(process.platform !== 'win32' && platformIsNotSupported)('on unsupported platform', () => {
describe('with properties', () => {
it('does not set a badge count', function () {
if (platformIsSupported) return this.skip();
app.badgeCount = 9999;
expect(app.badgeCount).to.equal(0);
});
});
it('with functions', () => {
describe('with functions', () => {
it('does not set a badge count)', function () {
if (platformIsSupported) return this.skip();
app.setBadgeCount(9999);
expect(app.getBadgeCount()).to.equal(0);
});