mirror of
https://github.com/iconify/iconify.git
synced 2025-01-07 15:44:05 +00:00
Update dependencies in icon components
This commit is contained in:
parent
286a623085
commit
0ec3270dc1
@ -25,18 +25,18 @@
|
||||
"devDependencies": {
|
||||
"@iconify/core": "workspace:^",
|
||||
"@iconify/utils": "workspace:^",
|
||||
"@microsoft/api-extractor": "^7.25.2",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-typescript": "^8.3.3",
|
||||
"rollup": "^2.75.6",
|
||||
"typescript": "^4.7.4"
|
||||
"@microsoft/api-extractor": "^7.30.0",
|
||||
"@rollup/plugin-node-resolve": "^14.0.0",
|
||||
"@rollup/plugin-typescript": "^8.5.0",
|
||||
"rollup": "^2.79.0",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@glimmer/component": "^1.1.2",
|
||||
"@glimmer/tracking": "^1.1.2",
|
||||
"@iconify/types": "workspace:^",
|
||||
"ember-cli-babel": "^7.26.11",
|
||||
"ember-cli-htmlbars": "^6.0.1"
|
||||
"ember-cli-htmlbars": "^6.1.0"
|
||||
},
|
||||
"ember": {
|
||||
"edition": "octane"
|
||||
|
@ -48,20 +48,20 @@
|
||||
"@iconify/types": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@babel/preset-react": "^7.17.12",
|
||||
"@babel/preset-env": "^7.19.0",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@iconify/core": "workspace:^",
|
||||
"@iconify/utils": "workspace:^",
|
||||
"@microsoft/api-extractor": "^7.25.2",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@types/react": "^17.0.47",
|
||||
"babel-jest": "^27.5.1",
|
||||
"jest": "^28.1.1",
|
||||
"react": "^17.0.2",
|
||||
"react-test-renderer": "^17.0.2",
|
||||
"@microsoft/api-extractor": "^7.30.0",
|
||||
"@rollup/plugin-node-resolve": "^14.0.0",
|
||||
"@types/react": "^17.0.49",
|
||||
"babel-jest": "^29.0.2",
|
||||
"jest": "^29.0.2",
|
||||
"react": "^18.2.0",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.75.6",
|
||||
"typescript": "^4.7.4"
|
||||
"rollup": "^2.79.0",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16"
|
||||
|
@ -74,22 +74,22 @@
|
||||
"devDependencies": {
|
||||
"@iconify/core": "workspace:^",
|
||||
"@iconify/utils": "workspace:^",
|
||||
"@microsoft/api-extractor": "^7.25.2",
|
||||
"@microsoft/api-extractor": "^7.30.0",
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-node-resolve": "^14.0.0",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/jsdom": "^16.2.14",
|
||||
"@types/node": "^17.0.45",
|
||||
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/jsdom": "^20.0.0",
|
||||
"@types/node": "^18.7.15",
|
||||
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.18.0",
|
||||
"jest": "^28.1.1",
|
||||
"jsdom": "^19.0.0",
|
||||
"eslint": "^8.23.0",
|
||||
"jest": "^29.0.2",
|
||||
"jsdom": "^20.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.75.6",
|
||||
"rollup": "^2.79.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"ts-jest": "28.0.0-next.3",
|
||||
"typescript": "^4.7.4"
|
||||
"ts-jest": "^29.0.0-next.1",
|
||||
"typescript": "^4.8.2"
|
||||
}
|
||||
}
|
||||
|
@ -4,21 +4,25 @@ import { onReady } from '../src/helpers/ready';
|
||||
describe('Testing onReady callback', () => {
|
||||
afterEach(cleanupGlobals);
|
||||
|
||||
it('Testing onReady before DOM is loaded', (done) => {
|
||||
it('Testing onReady before DOM is loaded', () => {
|
||||
return new Promise((fulfill) => {
|
||||
setupDOM('');
|
||||
expect(document.readyState).toBe('loading');
|
||||
onReady(() => {
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Testing onReady after DOM is loaded', (done) => {
|
||||
it('Testing onReady after DOM is loaded', () => {
|
||||
return new Promise((fulfill) => {
|
||||
setupDOM('');
|
||||
expect(document.readyState).toBe('loading');
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
expect(document.readyState).toBe('interactive');
|
||||
onReady(() => {
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -45,19 +45,19 @@
|
||||
"@iconify/types": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@babel/preset-env": "^7.19.0",
|
||||
"@iconify/core": "workspace:^",
|
||||
"@iconify/utils": "workspace:^",
|
||||
"@microsoft/api-extractor": "^7.25.2",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@vitejs/plugin-vue": "^2.3.3",
|
||||
"@vue/test-utils": "^2.0.1",
|
||||
"jsdom": "^19.0.0",
|
||||
"rollup": "^2.75.6",
|
||||
"typescript": "^4.7.4",
|
||||
"vitest": "^0.7.13",
|
||||
"vue": "^3.2.37"
|
||||
"@microsoft/api-extractor": "^7.30.0",
|
||||
"@rollup/plugin-node-resolve": "^14.0.0",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@vitejs/plugin-vue": "^3.1.0",
|
||||
"@vue/test-utils": "^2.0.2",
|
||||
"jsdom": "^20.0.0",
|
||||
"rollup": "^2.79.0",
|
||||
"typescript": "^4.8.2",
|
||||
"vitest": "^0.23.1",
|
||||
"vue": "^3.2.38"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": ">=3"
|
||||
|
@ -3,7 +3,8 @@ import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
|
||||
import { provider, nextPrefix } from './load';
|
||||
|
||||
describe('Testing fake API', () => {
|
||||
test('using fake API to load icon', (done) => {
|
||||
test('using fake API to load icon', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'mock-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -35,7 +36,8 @@ describe('Testing fake API', () => {
|
||||
]);
|
||||
expect(missing).toMatchObject([]);
|
||||
expect(pending).toMatchObject([]);
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -12,7 +12,8 @@ const iconData = {
|
||||
};
|
||||
|
||||
describe('Rendering icon', () => {
|
||||
test('rendering icon after loading it', (done) => {
|
||||
test('rendering icon after loading it', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'render-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -76,13 +77,15 @@ describe('Rendering icon', () => {
|
||||
// Make sure onLoad has been called
|
||||
expect(onLoadCalled).toEqual(true);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('rendering icon before loading it', (done) => {
|
||||
test('rendering icon before loading it', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'mock-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -139,9 +142,9 @@ describe('Rendering icon', () => {
|
||||
'" width="1em" height="1em" viewBox="0 0 24 24"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
@ -159,8 +162,10 @@ describe('Rendering icon', () => {
|
||||
// onLoad should not have been called yet
|
||||
expect(onLoadCalled).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
test('missing icon', (done) => {
|
||||
test('missing icon', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'missing-icon';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -191,9 +196,9 @@ describe('Rendering icon', () => {
|
||||
})
|
||||
.then(() => {
|
||||
expect(wrapper.html()).toEqual(defaultIconResult);
|
||||
done();
|
||||
fulfill(true);
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
},
|
||||
});
|
||||
|
||||
@ -212,4 +217,5 @@ describe('Rendering icon', () => {
|
||||
};
|
||||
const wrapper = mount(Wrapper, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -17,7 +17,8 @@ const iconData2 = {
|
||||
};
|
||||
|
||||
describe('Rendering icon', () => {
|
||||
test('changing icon property', (done) => {
|
||||
test('changing icon property', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'changing-prop';
|
||||
const name2 = 'changing-prop2';
|
||||
@ -48,7 +49,7 @@ describe('Rendering icon', () => {
|
||||
icon: iconName2,
|
||||
});
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
|
||||
break;
|
||||
|
||||
@ -67,9 +68,9 @@ describe('Rendering icon', () => {
|
||||
'"><path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"></path></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
|
||||
break;
|
||||
|
||||
@ -145,8 +146,10 @@ describe('Rendering icon', () => {
|
||||
// onLoad should not have been called yet
|
||||
expect(onLoadCalled).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
test('changing icon property while loading', (done) => {
|
||||
test('changing icon property while loading', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'changing-prop';
|
||||
const name2 = 'changing-prop2';
|
||||
@ -158,7 +161,7 @@ describe('Rendering icon', () => {
|
||||
const onLoad = (name) => {
|
||||
switch (name) {
|
||||
case iconName:
|
||||
done('onLoad should not be called for initial icon');
|
||||
reject('onLoad should not be called for initial icon');
|
||||
break;
|
||||
|
||||
case iconName2:
|
||||
@ -173,9 +176,9 @@ describe('Rendering icon', () => {
|
||||
'"><path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"></path></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
})
|
||||
.catch(done);
|
||||
.catch(reject);
|
||||
|
||||
break;
|
||||
|
||||
@ -249,8 +252,10 @@ describe('Rendering icon', () => {
|
||||
// Async
|
||||
isSync = false;
|
||||
});
|
||||
});
|
||||
|
||||
test('changing multiple properties', (done) => {
|
||||
test('changing multiple properties', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'multiple-props';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -289,9 +294,9 @@ describe('Rendering icon', () => {
|
||||
'" style="color: red;"><g transform="translate(24 0) scale(-1 1)"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></g></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
} catch (err) {
|
||||
done(err);
|
||||
reject(err);
|
||||
}
|
||||
})();
|
||||
};
|
||||
@ -331,4 +336,5 @@ describe('Rendering icon', () => {
|
||||
};
|
||||
const wrapper = mount(Wrapper, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -45,19 +45,19 @@
|
||||
"@iconify/types": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.18.2",
|
||||
"@babel/preset-env": "^7.19.0",
|
||||
"@iconify/core": "workspace:^",
|
||||
"@iconify/utils": "workspace:^",
|
||||
"@microsoft/api-extractor": "^7.25.2",
|
||||
"@microsoft/api-extractor": "^7.30.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@vue/test-utils": "^1.3.0",
|
||||
"@vue/vue2-jest": "^27.0.0",
|
||||
"babel-jest": "^27.5.1",
|
||||
"jest": "28.0.0-alpha.11",
|
||||
"rollup": "^2.75.6",
|
||||
"typescript": "^4.7.4",
|
||||
"vue": "^2.6.14"
|
||||
"@vue/vue2-jest": "^29.0.0",
|
||||
"babel-jest": "^29.0.2",
|
||||
"jest": "^29.0.2",
|
||||
"rollup": "^2.79.0",
|
||||
"typescript": "^4.8.2",
|
||||
"vue": "^2.7.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": "2.x"
|
||||
|
@ -6,7 +6,8 @@ import { mockAPIData } from '@iconify/core/lib/api/modules/mock.cjs';
|
||||
import { provider, nextPrefix } from './load';
|
||||
|
||||
describe('Testing fake API', () => {
|
||||
test('using fake API to load icon', done => {
|
||||
test('using fake API to load icon', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'mock-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -38,7 +39,8 @@ describe('Testing fake API', () => {
|
||||
]);
|
||||
expect(missing).toMatchObject([]);
|
||||
expect(pending).toMatchObject([]);
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -9,14 +9,14 @@ import { provider, nextPrefix } from './load';
|
||||
import { defaultIconResult } from '../empty';
|
||||
|
||||
const iconData = {
|
||||
body:
|
||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||
width: 24,
|
||||
height: 24,
|
||||
};
|
||||
|
||||
describe('Rendering icon', () => {
|
||||
test('rendering icon after loading it', done => {
|
||||
test('rendering icon after loading it', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'render-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -79,12 +79,14 @@ describe('Rendering icon', () => {
|
||||
// Make sure onLoad has been called
|
||||
expect(onLoadCalled).toBe(true);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('rendering icon before loading it', done => {
|
||||
test('rendering icon before loading it', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'mock-test';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -101,7 +103,7 @@ describe('Rendering icon', () => {
|
||||
[name]: iconData,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Icon should not have loaded yet
|
||||
expect(iconExists(iconName)).toBe(false);
|
||||
|
||||
@ -132,7 +134,9 @@ describe('Rendering icon', () => {
|
||||
// Test component on next tick
|
||||
Vue.nextTick(() => {
|
||||
// Check HTML
|
||||
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
||||
expect(
|
||||
wrapper.html().replace(/\s*\n\s*/g, '')
|
||||
).toBe(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 24 24" class="' +
|
||||
className +
|
||||
// 'foo' is appended because of weird Vue 2 behavior. Fixed in Vue 3
|
||||
@ -142,7 +146,7 @@ describe('Rendering icon', () => {
|
||||
// onLoad should have been called
|
||||
expect(onLoadCalled).toBe(true);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
},
|
||||
},
|
||||
@ -161,8 +165,10 @@ describe('Rendering icon', () => {
|
||||
// onLoad should not have been called yet
|
||||
expect(onLoadCalled).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
test('missing icon', done => {
|
||||
test('missing icon', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'missing-icon';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
@ -171,7 +177,7 @@ describe('Rendering icon', () => {
|
||||
provider,
|
||||
prefix,
|
||||
response: 404,
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Icon should not have loaded yet
|
||||
expect(iconExists(iconName)).toBe(false);
|
||||
|
||||
@ -187,7 +193,7 @@ describe('Rendering icon', () => {
|
||||
Vue.nextTick(() => {
|
||||
expect(wrapper.html()).toBe(defaultIconResult);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -212,4 +218,5 @@ describe('Rendering icon', () => {
|
||||
// Should render empty icon
|
||||
expect(wrapper.html()).toBe(defaultIconResult);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -9,21 +9,20 @@ import { provider, nextPrefix } from './load';
|
||||
import { defaultIconResult } from '../empty';
|
||||
|
||||
const iconData = {
|
||||
body:
|
||||
'<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||
body: '<path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"/>',
|
||||
width: 24,
|
||||
height: 24,
|
||||
};
|
||||
|
||||
const iconData2 = {
|
||||
body:
|
||||
'<path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"/>',
|
||||
body: '<path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"/>',
|
||||
width: 32,
|
||||
height: 32,
|
||||
};
|
||||
|
||||
describe('Rendering icon', () => {
|
||||
test('changing icon property', done => {
|
||||
test('changing icon property', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'changing-prop';
|
||||
const name2 = 'changing-prop2';
|
||||
@ -32,7 +31,7 @@ describe('Rendering icon', () => {
|
||||
const className = `iconify iconify--${prefix} iconify--${provider}`;
|
||||
let onLoadCalled = ''; // Name of icon from last onLoad call
|
||||
|
||||
const onLoad = name => {
|
||||
const onLoad = (name) => {
|
||||
// onLoad should be called only once per icon
|
||||
switch (name) {
|
||||
// First onLoad call
|
||||
@ -41,7 +40,9 @@ describe('Rendering icon', () => {
|
||||
|
||||
// Wait 1 tick, then test rendered icon
|
||||
Vue.nextTick(() => {
|
||||
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
||||
expect(
|
||||
wrapper.html().replace(/\s*\n\s*/g, '')
|
||||
).toBe(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 24 24" class="' +
|
||||
className +
|
||||
'"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></svg>'
|
||||
@ -62,7 +63,9 @@ describe('Rendering icon', () => {
|
||||
|
||||
// Wait 1 tick, then test rendered icon
|
||||
Vue.nextTick(() => {
|
||||
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
||||
expect(
|
||||
wrapper.html().replace(/\s*\n\s*/g, '')
|
||||
).toBe(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 32 32" class="' +
|
||||
className +
|
||||
'"><path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"></path></svg>'
|
||||
@ -71,7 +74,7 @@ describe('Rendering icon', () => {
|
||||
// onLoad should have been called for second icon
|
||||
expect(onLoadCalled).toBe(iconName2);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
break;
|
||||
|
||||
@ -91,7 +94,7 @@ describe('Rendering icon', () => {
|
||||
[name]: iconData,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Icon should not have loaded yet
|
||||
expect(iconExists(iconName)).toBe(false);
|
||||
|
||||
@ -116,7 +119,7 @@ describe('Rendering icon', () => {
|
||||
[name2]: iconData2,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Icon should not have loaded yet
|
||||
expect(iconExists(iconName2)).toBe(false);
|
||||
|
||||
@ -148,8 +151,10 @@ describe('Rendering icon', () => {
|
||||
// onLoad should not have been called yet
|
||||
expect(onLoadCalled).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
test('changing icon property while loading', done => {
|
||||
test('changing icon property while loading', () => {
|
||||
return new Promise((fulfill, reject) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'changing-prop';
|
||||
const name2 = 'changing-prop2';
|
||||
@ -158,22 +163,24 @@ describe('Rendering icon', () => {
|
||||
const className = `iconify iconify--${prefix} iconify--${provider}`;
|
||||
let isSync = true;
|
||||
|
||||
const onLoad = name => {
|
||||
const onLoad = (name) => {
|
||||
switch (name) {
|
||||
case iconName:
|
||||
done('onLoad should not be called for initial icon');
|
||||
reject('onLoad should not be called for initial icon');
|
||||
break;
|
||||
|
||||
case iconName2:
|
||||
// Wait 1 tick, then test rendered icon
|
||||
Vue.nextTick(() => {
|
||||
expect(wrapper.html().replace(/\s*\n\s*/g, '')).toBe(
|
||||
expect(
|
||||
wrapper.html().replace(/\s*\n\s*/g, '')
|
||||
).toBe(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" viewBox="0 0 32 32" class="' +
|
||||
className +
|
||||
'"><path d="M19.031 4.281l-11 11l-.687.719l.687.719l11 11l1.438-1.438L10.187 16L20.47 5.719z" fill="currentColor"></path></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
|
||||
break;
|
||||
@ -193,7 +200,7 @@ describe('Rendering icon', () => {
|
||||
[name]: iconData,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Should have been called asynchronously, which means icon name has changed
|
||||
expect(isSync).toBe(false);
|
||||
|
||||
@ -212,7 +219,7 @@ describe('Rendering icon', () => {
|
||||
[name2]: iconData2,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Should have been called asynchronously
|
||||
expect(isSync).toBe(false);
|
||||
|
||||
@ -249,14 +256,16 @@ describe('Rendering icon', () => {
|
||||
// Async
|
||||
isSync = false;
|
||||
});
|
||||
});
|
||||
|
||||
test('changing multiple properties', done => {
|
||||
test('changing multiple properties', () => {
|
||||
return new Promise((fulfill) => {
|
||||
const prefix = nextPrefix();
|
||||
const name = 'multiple-props';
|
||||
const iconName = `@${provider}:${prefix}:${name}`;
|
||||
const className = `iconify iconify--${prefix} iconify--${provider}`;
|
||||
|
||||
const onLoad = name => {
|
||||
const onLoad = (name) => {
|
||||
expect(name).toBe(iconName);
|
||||
|
||||
// Wait 1 tick, test rendered icon
|
||||
@ -284,7 +293,7 @@ describe('Rendering icon', () => {
|
||||
'" style="color: red;"><g transform="translate(24 0) scale(-1 1)"><path d="M4 19h16v2H4zm5-4h11v2H9zm-5-4h16v2H4zm0-8h16v2H4zm5 4h11v2H9z" fill="currentColor"></path></g></svg>'
|
||||
);
|
||||
|
||||
done();
|
||||
fulfill(true);
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -299,7 +308,7 @@ describe('Rendering icon', () => {
|
||||
[name]: iconData,
|
||||
},
|
||||
},
|
||||
delay: next => {
|
||||
delay: (next) => {
|
||||
// Icon should not have loaded yet
|
||||
expect(iconExists(iconName)).toBe(false);
|
||||
|
||||
@ -325,4 +334,5 @@ describe('Rendering icon', () => {
|
||||
// Should be empty
|
||||
expect(wrapper.html()).toBe(defaultIconResult);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user