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

51 lines
2.3 KiB
JavaScript
Raw Normal View History

define(["require", "exports", "./properties"], function (require, exports, properties_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
describe('getNativeProps', function () {
it('can pass through data tags', function () {
var result = (0, properties_1.getNativeProps)({
'data-automation-id': 1,
}, properties_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 = (0, properties_1.getNativeProps)({
'aria-label': 1,
}, properties_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 = (0, properties_1.getNativeProps)({
className: 'foo',
onClick: function () {
/* no-op */
},
onClickCapture: function () {
/* no-op */
},
}, properties_1.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 = (0, properties_1.getNativeProps)({
foobar: 1,
className: 'hi',
}, properties_1.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 = (0, properties_1.getNativeProps)({ a: 1, b: 2 }, ['a', 'b'], ['b']);
expect(result.a).toBeDefined();
expect(result.b).toBeUndefined();
});
});
});
//# sourceMappingURL=properties.test.js.map