Outlook_Addin_LLM/node_modules/@fluentui/utilities/lib/properties.test.js

48 lines
1.9 KiB
JavaScript

import { getNativeProps, divProperties } from './properties';
describe('getNativeProps', function () {
it('can pass through data tags', function () {
var result = getNativeProps({
'data-automation-id': 1,
}, divProperties);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(result['data-automation-id']).toEqual(1);
});
it('can pass through aria tags', function () {
var result = getNativeProps({
'aria-label': 1,
}, divProperties);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(result['aria-label']).toEqual(1);
});
it('can pass through basic div properties and events', function () {
var result = getNativeProps({
className: 'foo',
onClick: function () {
/* no-op */
},
onClickCapture: function () {
/* no-op */
},
}, divProperties);
expect(result.className).toEqual('foo');
expect(typeof result.onClick).toEqual('function');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(typeof result.onClickCapture).toEqual('function');
});
it('can remove unexpected properties', function () {
var result = getNativeProps({
foobar: 1,
className: 'hi',
}, divProperties);
expect(result.className).toEqual('hi');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
expect(result.foobar).toEqual(undefined);
});
it('can exclude properties', function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var result = getNativeProps({ a: 1, b: 2 }, ['a', 'b'], ['b']);
expect(result.a).toBeDefined();
expect(result.b).toBeUndefined();
});
});
//# sourceMappingURL=properties.test.js.map