mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-04 02:51:19 +08:00
Also updates of devtools front end to include ancestor chain bit This change updates the front end of devtools to handle the ancestor chain bit that has been added to partitioned cookies. All call sites that previously used the optional string version of the partition key have been updated and additional tests have been added to cover the new behavior. Bug:340603832 Also-by: selya@google.com Change-Id: Ib9462d2939596286363c358e49f4685040b5d90b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5601392 Reviewed-by: Alex Rudenko <alexrudenko@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org> Commit-Queue: Andres Olivares <andoli@chromium.org>
63 lines
2.3 KiB
TypeScript
63 lines
2.3 KiB
TypeScript
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import * as JavascriptMetadata from './javascript_metadata.js';
|
|
|
|
describe('JavaScriptMetadata', () => {
|
|
let metadata: JavascriptMetadata.JavaScriptMetadata.JavaScriptMetadataImpl;
|
|
|
|
before(() => {
|
|
metadata = new JavascriptMetadata.JavaScriptMetadata.JavaScriptMetadataImpl();
|
|
});
|
|
|
|
it('retrieves native signature by name', () => {
|
|
const signatures = metadata.signaturesForNativeFunction('webkitRequestFullScreen');
|
|
assert.deepEqual(signatures, [['?options']]);
|
|
});
|
|
|
|
it('does not retrieve native signatures that are bound to an instance', () => {
|
|
const signatures = metadata.signaturesForNativeFunction('find');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
|
|
describe('with static methods', () => {
|
|
it('retrieves by name and class', () => {
|
|
const signatures = metadata.signaturesForStaticMethod('from', 'Array');
|
|
assert.deepEqual(signatures, [['iterable', '?mapfn', '?thisArg'], ['arrayLike', '?mapfn', '?thisArg']]);
|
|
});
|
|
|
|
it('does not retrieve methods that are bound to an instance', () => {
|
|
const signatures = metadata.signaturesForStaticMethod('includes', 'Array');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
|
|
it('handles a non-existing class', () => {
|
|
const signatures = metadata.signaturesForStaticMethod('includes', 'bogus');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
});
|
|
|
|
describe('with instance methods', () => {
|
|
it('retrieves by name and class', () => {
|
|
const signatures = metadata.signaturesForInstanceMethod('assign', 'HTMLSlotElement');
|
|
assert.deepEqual(signatures, [['...nodes']]);
|
|
});
|
|
|
|
it('does not retrieve methods that are unbound', () => {
|
|
const signatures = metadata.signaturesForInstanceMethod('webkitRequestFullScreen', 'window');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
|
|
it('does not retrieve static methods', () => {
|
|
const signatures = metadata.signaturesForInstanceMethod('from', 'Array');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
|
|
it('handles a non-existing class', () => {
|
|
const signatures = metadata.signaturesForInstanceMethod('from', 'Sheep');
|
|
assert.deepEqual(signatures, null);
|
|
});
|
|
});
|
|
});
|