From 0c1f515fafb61dc6586f8a47fbb4c9db9bc8b0e5 Mon Sep 17 00:00:00 2001 From: Brandon Dail Date: Mon, 6 Mar 2017 00:52:39 -0600 Subject: [PATCH] Remove sliceChildren (#9109) --- scripts/fiber/tests-passing.txt | 7 -- .../children/__tests__/sliceChildren-test.js | 93 ------------------- src/isomorphic/children/sliceChildren.js | 34 ------- 3 files changed, 134 deletions(-) delete mode 100644 src/isomorphic/children/__tests__/sliceChildren-test.js delete mode 100644 src/isomorphic/children/sliceChildren.js diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index ac6bdcf360..bd4121d8ed 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -157,13 +157,6 @@ src/isomorphic/children/__tests__/onlyChild-test.js * should not fail when passed interpolated single child * should return the only child -src/isomorphic/children/__tests__/sliceChildren-test.js -* should render the whole set if start zero is supplied -* should render the remaining set if no end index is supplied -* should exclude everything at or after the end index -* should allow static children to be sliced -* should slice nested children - src/isomorphic/classic/__tests__/ReactContextValidator-test.js * should filter out context not in contextTypes * should pass next context to lifecycles diff --git a/src/isomorphic/children/__tests__/sliceChildren-test.js b/src/isomorphic/children/__tests__/sliceChildren-test.js deleted file mode 100644 index d09ab6757f..0000000000 --- a/src/isomorphic/children/__tests__/sliceChildren-test.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @emails react-core - */ - -'use strict'; - -describe('sliceChildren', () => { - - var React; - - var sliceChildren; - - beforeEach(() => { - React = require('react'); - - sliceChildren = require('sliceChildren'); - }); - - it('should render the whole set if start zero is supplied', () => { - var fullSet = [ -
, -
, -
, - ]; - var children = sliceChildren(fullSet, 0); - expect(children).toEqual([ -
, -
, -
, - ]); - }); - - it('should render the remaining set if no end index is supplied', () => { - var fullSet = [ -
, -
, -
, - ]; - var children = sliceChildren(fullSet, 1); - expect(children).toEqual([ -
, -
, - ]); - }); - - it('should exclude everything at or after the end index', () => { - var fullSet = [ -
, -
, -
, -
, - ]; - var children = sliceChildren(fullSet, 1, 2); - expect(children).toEqual([ -
, - ]); - }); - - it('should allow static children to be sliced', () => { - var a = ; - var b = ; - var c = ; - - var el =
{a}{b}{c}
; - var children = sliceChildren(el.props.children, 1, 2); - expect(children).toEqual([ - , - ]); - }); - - it('should slice nested children', () => { - var fullSet = [ -
, - [ -
, -
, - ], -
, - ]; - var children = sliceChildren(fullSet, 1, 2); - expect(children).toEqual([ -
, - ]); - }); - -}); diff --git a/src/isomorphic/children/sliceChildren.js b/src/isomorphic/children/sliceChildren.js deleted file mode 100644 index 691af1da34..0000000000 --- a/src/isomorphic/children/sliceChildren.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule sliceChildren - */ - -'use strict'; - -var ReactChildren = require('ReactChildren'); - -/** - * Slice children that are typically specified as `props.children`. This version - * of slice children ignores empty child components. - * - * @param {*} children The children set to filter. - * @param {number} start The first zero-based index to include in the subset. - * @param {?number} end The non-inclusive last index of the subset. - * @return {object} mirrored array with mapped children - */ -function sliceChildren(children, start, end) { - if (children == null) { - return children; - } - - var array = ReactChildren.toArray(children); - return array.slice(start, end); -} - -module.exports = sliceChildren;